OpearFile implements Opear { static Result<Manifest> readExpectedManifest(final @NotNull File mfFile) { try (InputStream input = new FileInputStream(mfFile)) { return Result.success(new Manifest(input)); } catch (IOException e) { return Result.failure(e); } } OpearFile(final File cacheDir, final OpearMetadata metadata); @Override URL getDefaultPlan(); @Override Result<URL> getSpecificPlan(final @NotNull String planName); @Override ClassLoader getPlanClassLoader(final @NotNull ClassLoader parent); static Result<OpearFile> fromDirectory(final @NotNull File directory); static Result<OpearFile> fromJar(final @NotNull JarFile jarFile, final @NotNull File cacheBaseDir); static final Attributes.Name NAME_BUNDLE_SYMBOLICNAME; static final Attributes.Name NAME_BUNDLE_VERSION; static final Attributes.Name NAME_CLASS_PATH; static final Attributes.Name NAME_OAKPAL_VERSION; static final Attributes.Name NAME_OAKPAL_PLAN; }
@Test public void testReadNonExistingManifest() { assertTrue("non-existing file can't be read", OpearFile.readExpectedManifest( new File("src/test/resources/OpearFileTest/non-existing-file.mf")) .isFailure()); }