@Test(expected = MojoFailureException.class) public void testExecuteWebsterPlan_tempFails() throws Exception { final File testOutDir = new File(testOutBaseDir, "testExecuteWebsterPlan_tempFails"); recursiveDeleteWithRetry(testOutDir); final File projectRoot = new File(testOutDir, "content-package"); FileUtils.copyDirectory(new File(srcDir, "content-package"), projectRoot); WebsterMojo mojo = newMojo(); final File tempDir = new File(testOutDir, "webster-tmp"); FileUtils.touch(tempDir); mojo.websterTempDirectory = tempDir; final WebsterPlan.Builder builder = new WebsterPlan.Builder(); mojo.executeWebsterPlan(builder); }
void executeWebsterPlan(final @NotNull WebsterPlan.Builder builder) throws MojoFailureException { try { websterTempDirectory.mkdirs(); final File globalRepositoryHome = Files .createTempDirectory(websterTempDirectory.toPath(), "webster_repository") .toFile().getAbsoluteFile(); try { WebsterPlan plan = builder .withGlobalSegmentStore(new File(globalRepositoryHome, "segmentstore")).build(); plan.perform(); } catch (Exception e) { throw new MojoFailureException("Failed to execute Webster plan.", e); } finally { try { tempDirDeleter.tryAccept(globalRepositoryHome); } catch (Exception e) { getLog().error("Failed to delete temp global segment store: " + globalRepositoryHome.getAbsolutePath(), e); } } } catch (IOException e) { throw new MojoFailureException("Failed to create temp global segment store", e); } }
WebsterMojo extends AbstractMojo { void executeWebsterPlan(final @NotNull WebsterPlan.Builder builder) throws MojoFailureException { try { websterTempDirectory.mkdirs(); final File globalRepositoryHome = Files .createTempDirectory(websterTempDirectory.toPath(), "webster_repository") .toFile().getAbsoluteFile(); try { WebsterPlan plan = builder .withGlobalSegmentStore(new File(globalRepositoryHome, "segmentstore")).build(); plan.perform(); } catch (Exception e) { throw new MojoFailureException("Failed to execute Webster plan.", e); } finally { try { tempDirDeleter.tryAccept(globalRepositoryHome); } catch (Exception e) { getLog().error("Failed to delete temp global segment store: " + globalRepositoryHome.getAbsolutePath(), e); } } } catch (IOException e) { throw new MojoFailureException("Failed to create temp global segment store", e); } } }
WebsterMojo extends AbstractMojo { void executeWebsterPlan(final @NotNull WebsterPlan.Builder builder) throws MojoFailureException { try { websterTempDirectory.mkdirs(); final File globalRepositoryHome = Files .createTempDirectory(websterTempDirectory.toPath(), "webster_repository") .toFile().getAbsoluteFile(); try { WebsterPlan plan = builder .withGlobalSegmentStore(new File(globalRepositoryHome, "segmentstore")).build(); plan.perform(); } catch (Exception e) { throw new MojoFailureException("Failed to execute Webster plan.", e); } finally { try { tempDirDeleter.tryAccept(globalRepositoryHome); } catch (Exception e) { getLog().error("Failed to delete temp global segment store: " + globalRepositoryHome.getAbsolutePath(), e); } } } catch (IOException e) { throw new MojoFailureException("Failed to create temp global segment store", e); } }  }
WebsterMojo extends AbstractMojo { void executeWebsterPlan(final @NotNull WebsterPlan.Builder builder) throws MojoFailureException { try { websterTempDirectory.mkdirs(); final File globalRepositoryHome = Files .createTempDirectory(websterTempDirectory.toPath(), "webster_repository") .toFile().getAbsoluteFile(); try { WebsterPlan plan = builder .withGlobalSegmentStore(new File(globalRepositoryHome, "segmentstore")).build(); plan.perform(); } catch (Exception e) { throw new MojoFailureException("Failed to execute Webster plan.", e); } finally { try { tempDirDeleter.tryAccept(globalRepositoryHome); } catch (Exception e) { getLog().error("Failed to delete temp global segment store: " + globalRepositoryHome.getAbsolutePath(), e); } } } catch (IOException e) { throw new MojoFailureException("Failed to create temp global segment store", e); } }  @Override final void execute(); }
WebsterMojo extends AbstractMojo { void executeWebsterPlan(final @NotNull WebsterPlan.Builder builder) throws MojoFailureException { try { websterTempDirectory.mkdirs(); final File globalRepositoryHome = Files .createTempDirectory(websterTempDirectory.toPath(), "webster_repository") .toFile().getAbsoluteFile(); try { WebsterPlan plan = builder .withGlobalSegmentStore(new File(globalRepositoryHome, "segmentstore")).build(); plan.perform(); } catch (Exception e) { throw new MojoFailureException("Failed to execute Webster plan.", e); } finally { try { tempDirDeleter.tryAccept(globalRepositoryHome); } catch (Exception e) { getLog().error("Failed to delete temp global segment store: " + globalRepositoryHome.getAbsolutePath(), e); } } } catch (IOException e) { throw new MojoFailureException("Failed to create temp global segment store", e); } }  @Override final void execute(); static final String PARAM_REPOSITORY_HOME; static final String PARAM_OAK_RUN_ARGS; static final String PARAM_TMPDIR; }