org.apache.flink.shaded.guava18.com.google.common.io.Files Java Examples
The following examples show how to use
org.apache.flink.shaded.guava18.com.google.common.io.Files.
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: FileCacheReadsFromBlobTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Test public void testFileDownloadedFromBlob() throws Exception { JobID jobID = new JobID(); ExecutionAttemptID attemptID = new ExecutionAttemptID(); final String fileName = "test_file"; // copy / create the file final DistributedCache.DistributedCacheEntry entry = new DistributedCache.DistributedCacheEntry( fileName, false, InstantiationUtil.serializeObject(permanentBlobKey)); Future<Path> copyResult = fileCache.createTmpFile(fileName, entry, jobID, attemptID); final Path dstPath = copyResult.get(); final String actualContent = Files.toString(new File(dstPath.toUri()), StandardCharsets.UTF_8); assertTrue(dstPath.getFileSystem().exists(dstPath)); assertEquals(testFileContent, actualContent); }
Example #2
Source File: FileCacheReadsFromBlobTest.java From flink with Apache License 2.0 | 6 votes |
@Test public void testFileDownloadedFromBlob() throws Exception { JobID jobID = new JobID(); ExecutionAttemptID attemptID = new ExecutionAttemptID(); final String fileName = "test_file"; // copy / create the file final DistributedCache.DistributedCacheEntry entry = new DistributedCache.DistributedCacheEntry( fileName, false, InstantiationUtil.serializeObject(permanentBlobKey)); Future<Path> copyResult = fileCache.createTmpFile(fileName, entry, jobID, attemptID); final Path dstPath = copyResult.get(); final String actualContent = Files.toString(new File(dstPath.toUri()), StandardCharsets.UTF_8); assertTrue(dstPath.getFileSystem().exists(dstPath)); assertEquals(testFileContent, actualContent); }
Example #3
Source File: FlinkConfMountDecorator.java From flink with Apache License 2.0 | 6 votes |
@Override public List<HasMetadata> buildAccompanyingKubernetesResources() throws IOException { final String clusterId = kubernetesComponentConf.getClusterId(); final Map<String, String> data = new HashMap<>(); final List<File> localLogFiles = getLocalLogConfFiles(); for (File file : localLogFiles) { data.put(file.getName(), Files.toString(file, StandardCharsets.UTF_8)); } final Map<String, String> propertiesMap = getClusterSidePropertiesMap(kubernetesComponentConf.getFlinkConfiguration()); data.put(FLINK_CONF_FILENAME, getFlinkConfData(propertiesMap)); final ConfigMap flinkConfConfigMap = new ConfigMapBuilder() .withApiVersion(Constants.API_VERSION) .withNewMetadata() .withName(getFlinkConfConfigMapName(clusterId)) .withLabels(kubernetesComponentConf.getCommonLabels()) .endMetadata() .addToData(data) .build(); return Collections.singletonList(flinkConfConfigMap); }
Example #4
Source File: FileCacheReadsFromBlobTest.java From flink with Apache License 2.0 | 6 votes |
@Test public void testFileDownloadedFromBlob() throws Exception { JobID jobID = new JobID(); ExecutionAttemptID attemptID = new ExecutionAttemptID(); final String fileName = "test_file"; // copy / create the file final DistributedCache.DistributedCacheEntry entry = new DistributedCache.DistributedCacheEntry( fileName, false, InstantiationUtil.serializeObject(permanentBlobKey)); Future<Path> copyResult = fileCache.createTmpFile(fileName, entry, jobID, attemptID); final Path dstPath = copyResult.get(); final String actualContent = Files.toString(new File(dstPath.toUri()), StandardCharsets.UTF_8); assertTrue(dstPath.getFileSystem().exists(dstPath)); assertEquals(testFileContent, actualContent); }
Example #5
Source File: FileSystemBlobStore.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private boolean put(File fromFile, String toBlobPath) throws IOException { try (OutputStream os = fileSystem.create(new Path(toBlobPath), FileSystem.WriteMode.OVERWRITE)) { LOG.debug("Copying from {} to {}.", fromFile, toBlobPath); Files.copy(fromFile, os); } return true; }
Example #6
Source File: FileSystemBlobStore.java From flink with Apache License 2.0 | 5 votes |
private boolean put(File fromFile, String toBlobPath) throws IOException { try (OutputStream os = fileSystem.create(new Path(toBlobPath), FileSystem.WriteMode.OVERWRITE)) { LOG.debug("Copying from {} to {}.", fromFile, toBlobPath); Files.copy(fromFile, os); } return true; }
Example #7
Source File: FileSystemBlobStore.java From flink with Apache License 2.0 | 5 votes |
private boolean put(File fromFile, String toBlobPath) throws IOException { try (OutputStream os = fileSystem.create(new Path(toBlobPath), FileSystem.WriteMode.OVERWRITE)) { LOG.debug("Copying from {} to {}.", fromFile, toBlobPath); Files.copy(fromFile, os); } return true; }
Example #8
Source File: KubernetesTestUtils.java From flink with Apache License 2.0 | 4 votes |
public static void createTemporyFile(String data, File directory, String fileName) throws IOException { Files.write(data, new File(directory, fileName), StandardCharsets.UTF_8); }