flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dawidwys <...@git.apache.org>
Subject [GitHub] flink pull request #5580: [FLINK-8620] Enable shipping custom files to BlobS...
Date Fri, 23 Mar 2018 14:08:00 GMT
Github user dawidwys commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5580#discussion_r176745183
  
    --- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/blob/BlobClientTest.java
---
    @@ -453,15 +460,51 @@ private void testGetFailsDuringStreaming(@Nullable final JobID jobId,
BlobKey.Bl
     	}
     
     	/**
    -	 * Tests the static {@link BlobClient#uploadJarFiles(InetSocketAddress, Configuration,
JobID, List)} helper.
    +	 * Tests the static {@link BlobClient#uploadFiles(InetSocketAddress, Configuration,
JobID, List)} helper.
     	 */
     	@Test
     	public void testUploadJarFilesHelper() throws Exception {
     		uploadJarFile(getBlobServer(), getBlobClientConfig());
     	}
     
    +	@Test
    +	public void testDirectoryUploading() throws IOException {
    +		final File newFolder = temporaryFolder.newFolder();
    +		final File file1 = File.createTempFile("pre", "suff", newFolder);
    +		FileUtils.writeStringToFile(file1, "Test content");
    +		final File file2 = File.createTempFile("pre", "suff", newFolder);
    +		FileUtils.writeStringToFile(file2, "Test content 2");
    +
    +		final Map<String, File> files = new HashMap<>();
    +		files.put(file1.getName(), file1);
    +		files.put(file2.getName(), file2);
    +
    +		BlobKey key;
    +		final JobID jobId = new JobID();
    +		final InetSocketAddress inetAddress = new InetSocketAddress("localhost", getBlobServer().getPort());
    +		try (
    +			BlobClient client = new BlobClient(
    +				inetAddress, getBlobClientConfig())) {
    +
    +			key = client.uploadFile(jobId, new Path(newFolder.getPath()));
    +		}
    +
    +		final File file = getBlobServer().getFile(jobId, (PermanentBlobKey) key);
    +
    +		try (ZipInputStream zis = new ZipInputStream(new FileInputStream(file))) {
    +			ZipEntry entry;
    +			while ((entry = zis.getNextEntry()) != null) {
    --- End diff --
    
    It does not need to. `getNextEntry` does it, at the very beginning.


---

Mime
View raw message