@Test public void doAction_success() throws PersistenceException, WCMException { String result = action.doAction(resource); assertTrue(result.contains("Deleted page")); }
@Override public String doAction(Resource resource) throws PersistenceException { Page page = context.getPageManager().getContainingPage(resource); if (page == null) { return "Unable to find a page for resource " + resource.getPath(); } String successMessage = "Deleted page " + page.getPath(); if (context.isDryRun()) { return successMessage; } try { context.getPageManager().delete(page, false); } catch (WCMException e) { throw new PersistenceException("Unable to delete " + page.getPath()); } return successMessage; }
DeletePageAction implements Action { @Override public String doAction(Resource resource) throws PersistenceException { Page page = context.getPageManager().getContainingPage(resource); if (page == null) { return "Unable to find a page for resource " + resource.getPath(); } String successMessage = "Deleted page " + page.getPath(); if (context.isDryRun()) { return successMessage; } try { context.getPageManager().delete(page, false); } catch (WCMException e) { throw new PersistenceException("Unable to delete " + page.getPath()); } return successMessage; } }
DeletePageAction implements Action { @Override public String doAction(Resource resource) throws PersistenceException { Page page = context.getPageManager().getContainingPage(resource); if (page == null) { return "Unable to find a page for resource " + resource.getPath(); } String successMessage = "Deleted page " + page.getPath(); if (context.isDryRun()) { return successMessage; } try { context.getPageManager().delete(page, false); } catch (WCMException e) { throw new PersistenceException("Unable to delete " + page.getPath()); } return successMessage; } DeletePageAction(BindingContext context); }
DeletePageAction implements Action { @Override public String doAction(Resource resource) throws PersistenceException { Page page = context.getPageManager().getContainingPage(resource); if (page == null) { return "Unable to find a page for resource " + resource.getPath(); } String successMessage = "Deleted page " + page.getPath(); if (context.isDryRun()) { return successMessage; } try { context.getPageManager().delete(page, false); } catch (WCMException e) { throw new PersistenceException("Unable to delete " + page.getPath()); } return successMessage; } DeletePageAction(BindingContext context); @Override String doAction(Resource resource); }
DeletePageAction implements Action { @Override public String doAction(Resource resource) throws PersistenceException { Page page = context.getPageManager().getContainingPage(resource); if (page == null) { return "Unable to find a page for resource " + resource.getPath(); } String successMessage = "Deleted page " + page.getPath(); if (context.isDryRun()) { return successMessage; } try { context.getPageManager().delete(page, false); } catch (WCMException e) { throw new PersistenceException("Unable to delete " + page.getPath()); } return successMessage; } DeletePageAction(BindingContext context); @Override String doAction(Resource resource);  }