@Test(expected = AbortedScanException.class) public void testProcessPackageFile_abortOnRefreshFailure() throws Exception { final File testPackage = TestPackageUtil.prepareTestPackage("tmp_foo_bar.zip"); final Session session = mock(Session.class); doThrow(RepositoryException.class).when(session).refresh(false); final JcrPackageManager manager = mock(JcrPackageManager.class, withSettings().lenient()); doThrow(NullPointerException.class).when(manager) .upload(any(File.class), anyBoolean(), anyBoolean(), nullable(String.class), anyBoolean()); builder().build().processPackageFile(session, manager, true, testPackage); }
final void processPackageFile(final @NotNull Session admin, final @NotNull JcrPackageManager manager, final boolean preInstall, final @NotNull File file) throws AbortedScanException { try { admin.refresh(false); } catch (final RepositoryException e) { throw new AbortedScanException(e); } try (JcrPackage jcrPackage = manager.upload(file, false, true, null, true)) { processUploadedPackage(admin, manager, preInstall, jcrPackage); } catch (IOException | PackageException | RepositoryException | Fun.FunRuntimeException e) { throw new AbortedScanException(e, file); } }
OakMachine { final void processPackageFile(final @NotNull Session admin, final @NotNull JcrPackageManager manager, final boolean preInstall, final @NotNull File file) throws AbortedScanException { try { admin.refresh(false); } catch (final RepositoryException e) { throw new AbortedScanException(e); } try (JcrPackage jcrPackage = manager.upload(file, false, true, null, true)) { processUploadedPackage(admin, manager, preInstall, jcrPackage); } catch (IOException | PackageException | RepositoryException | Fun.FunRuntimeException e) { throw new AbortedScanException(e, file); } } }
OakMachine { final void processPackageFile(final @NotNull Session admin, final @NotNull JcrPackageManager manager, final boolean preInstall, final @NotNull File file) throws AbortedScanException { try { admin.refresh(false); } catch (final RepositoryException e) { throw new AbortedScanException(e); } try (JcrPackage jcrPackage = manager.upload(file, false, true, null, true)) { processUploadedPackage(admin, manager, preInstall, jcrPackage); } catch (IOException | PackageException | RepositoryException | Fun.FunRuntimeException e) { throw new AbortedScanException(e, file); } } private  OakMachine(final Packaging packagingService,
                       final List<ProgressCheck> progressChecks,
                       final ErrorListener errorListener,
                       final List<URL> preInstallUrls,
                       final List<InitStage> initStages,
                       final JcrCustomizer jcrCustomizer,
                       final InstallHookProcessorFactory installHookProcessorFactory,
                       final ClassLoader installHookClassLoader,
                       final boolean enablePreInstallHooks,
                       final InstallHookPolicy scanInstallHookPolicy,
                       final Supplier<NodeStore> nodeStoreSupplier,
                       final SubpackageSilencer subpackageSilencer,
                       final RepoInitProcessor repoInitProcessor,
                       final SlingSimulatorBackend slingSimulator,
                       final Set<String> runModes); }
OakMachine { final void processPackageFile(final @NotNull Session admin, final @NotNull JcrPackageManager manager, final boolean preInstall, final @NotNull File file) throws AbortedScanException { try { admin.refresh(false); } catch (final RepositoryException e) { throw new AbortedScanException(e); } try (JcrPackage jcrPackage = manager.upload(file, false, true, null, true)) { processUploadedPackage(admin, manager, preInstall, jcrPackage); } catch (IOException | PackageException | RepositoryException | Fun.FunRuntimeException e) { throw new AbortedScanException(e, file); } } private  OakMachine(final Packaging packagingService,
                       final List<ProgressCheck> progressChecks,
                       final ErrorListener errorListener,
                       final List<URL> preInstallUrls,
                       final List<InitStage> initStages,
                       final JcrCustomizer jcrCustomizer,
                       final InstallHookProcessorFactory installHookProcessorFactory,
                       final ClassLoader installHookClassLoader,
                       final boolean enablePreInstallHooks,
                       final InstallHookPolicy scanInstallHookPolicy,
                       final Supplier<NodeStore> nodeStoreSupplier,
                       final SubpackageSilencer subpackageSilencer,
                       final RepoInitProcessor repoInitProcessor,
                       final SlingSimulatorBackend slingSimulator,
                       final Set<String> runModes); List<ProgressCheck> getProgressChecks(); ErrorListener getErrorListener(); @Deprecated List<File> getPreInstallFiles(); List<URL> getPreInstallUrls(); @SuppressWarnings("WeakerAccess") void initAndInspect(final InspectBody<E> inspectBody); void adminInitAndInspect(final InspectBody<E> inspectBody); List<CheckReport> scanPackage(final @NotNull File... file); List<CheckReport> scanPackages(final List<File> files); static Packaging newOakpalPackagingService(); static Packaging newOakpalPackagingService(final @NotNull ClassLoader classLoader); }
OakMachine { final void processPackageFile(final @NotNull Session admin, final @NotNull JcrPackageManager manager, final boolean preInstall, final @NotNull File file) throws AbortedScanException { try { admin.refresh(false); } catch (final RepositoryException e) { throw new AbortedScanException(e); } try (JcrPackage jcrPackage = manager.upload(file, false, true, null, true)) { processUploadedPackage(admin, manager, preInstall, jcrPackage); } catch (IOException | PackageException | RepositoryException | Fun.FunRuntimeException e) { throw new AbortedScanException(e, file); } } private  OakMachine(final Packaging packagingService,
                       final List<ProgressCheck> progressChecks,
                       final ErrorListener errorListener,
                       final List<URL> preInstallUrls,
                       final List<InitStage> initStages,
                       final JcrCustomizer jcrCustomizer,
                       final InstallHookProcessorFactory installHookProcessorFactory,
                       final ClassLoader installHookClassLoader,
                       final boolean enablePreInstallHooks,
                       final InstallHookPolicy scanInstallHookPolicy,
                       final Supplier<NodeStore> nodeStoreSupplier,
                       final SubpackageSilencer subpackageSilencer,
                       final RepoInitProcessor repoInitProcessor,
                       final SlingSimulatorBackend slingSimulator,
                       final Set<String> runModes); List<ProgressCheck> getProgressChecks(); ErrorListener getErrorListener(); @Deprecated List<File> getPreInstallFiles(); List<URL> getPreInstallUrls(); @SuppressWarnings("WeakerAccess") void initAndInspect(final InspectBody<E> inspectBody); void adminInitAndInspect(final InspectBody<E> inspectBody); List<CheckReport> scanPackage(final @NotNull File... file); List<CheckReport> scanPackages(final List<File> files); static Packaging newOakpalPackagingService(); static Packaging newOakpalPackagingService(final @NotNull ClassLoader classLoader); static final String NS_URI_OAKPAL; static final String NS_PREFIX_OAKPAL; static final String LN_UNDECLARED; static final String NT_UNDECLARED; }