flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zentol <...@git.apache.org>
Subject [GitHub] flink pull request #6263: [FLINK-9743][Client] Use correct zip/jar path sepa...
Date Tue, 10 Jul 2018 10:24:40 GMT
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/6263#discussion_r201291422
  
    --- Diff: flink-clients/src/test/java/org/apache/flink/client/program/PackagedProgramTest.java
---
    @@ -56,6 +63,54 @@ public void testGetPreviewPlan() {
     		}
     	}
     
    +	/**
    +	 * The test for {@link PackagedProgram#extractContainedLibraries}.
    +	 * As a prerequisite the test generates a jar file with the following structure
    +	 * test.jar
    +	 * |- lib
    +	 * |--|- internalTest.jar
    +	 */
    +	@Test
    +	public void testExtractContainedLibraries() {
    +		String s = "testExtractContainedLibraries";
    +		Path workDir = null;
    +		Path fakeJar = null;
    +		try {
    +			workDir = Files.createTempDirectory(PackagedProgram.class.getSimpleName() + "_");
    +			fakeJar = Paths.get(workDir.toAbsolutePath().toString(), "test.jar");
    +			FileOutputStream fos = new FileOutputStream(fakeJar.toFile());
    +			try (ZipOutputStream zos = new ZipOutputStream(fos)) {
    +				ZipEntry entry = new ZipEntry("lib/internalTest.jar");
    +				zos.putNextEntry(entry);
    +				zos.write(s.getBytes());
    +				zos.closeEntry();
    +			} catch (IOException e) {
    +				System.err.println(e.getMessage());
    +				e.printStackTrace();
    +				Assert.fail("Test is erroneous: " + e.getMessage());
    +			}
    +			PackagedProgram.extractContainedLibraries(fakeJar.toUri().toURL());
    +		}
    +		catch (Exception e) {
    --- End diff --
    
    no need to catch them, just let them bubble up


---

Mime
View raw message