Class PackagingTestUtils

java.lang.Object
org.apache.flink.packaging.PackagingTestUtils

public class PackagingTestUtils extends Object
Test utils around jar packaging.
  • Constructor Details

    • PackagingTestUtils

      public PackagingTestUtils()
  • Method Details

    • assertJarContainsOnlyFilesMatching

      public static void assertJarContainsOnlyFilesMatching(Path jarPath, Collection<String> allowedPaths) throws Exception
      Verifies that all files in the jar match one of the provided allow strings.

      An allow item ending on a "/" is treated as an allowed parent directory. Otherwise, it is treated as an allowed file.

      For example, given a jar containing a file META-INF/NOTICES:

      These would pass:

      • "META-INF/"
      • "META-INF/NOTICES"

      These would fail:

      • "META-INF"
      • "META-INF/NOTICE"
      • "META-INF/NOTICES/"
      Throws:
      Exception
    • assertJarContainsServiceEntry

      public static void assertJarContainsServiceEntry(Path jarPath, Class<?> service) throws Exception
      Verifies that the given jar contains a service entry file for the given service.

      Caution: This only checks that the file exists; the content is not verified.

      Throws:
      Exception