mock.assertInvisible("link");
mock.assertVisible("sorry");
// step one, show the secure home page without a link to PageA
Page lastPage = mock.getLastRenderedPage();
SecurePageLink<?> link = (SecurePageLink<?>)lastPage.get("link");
LinkSecurityCheck linkcheck = ((LinkSecurityCheck)link.getSecurityCheck()).setUseAlternativeRenderCheck(true);
// step two, show the secure home page with a not clickable link to
// PageA (e.g. not a href)
Map<String, WaspAction> authorized = new HashMap<String, WaspAction>();
authorized.put(SecureComponentHelper.alias(link),
application.getActionFactory().getAction("access render"));
login(authorized);
mock.startPage(lastPage);
mock.assertRenderedPage(getHomePage());
assertSame(lastPage, mock.getLastRenderedPage());
mock.assertInvisible("sorry");
mock.assertVisible("link");
TagTester tag = mock.getTagByWicketId("link");
assertNull(tag.getAttribute("href"));
assertNull(tag.getAttribute("onclick"));
// step three, show the secure home page with a clickable link to PageA
authorized.clear();
authorized.put(SecureComponentHelper.alias(HomePage.class), application.getActionFactory()
.getAction("access render enable"));
authorized.put(SecureComponentHelper.alias(PageA.class), application.getActionFactory()
.getAction("render enable"));
login(authorized);
Page page = mock.getLastRenderedPage();
mock.startPage(page);
tag = mock.getTagByWicketId("link");
assertNotNull(tag.getAttribute("href"));
logoff(authorized);
authorized.clear();
// step four, show the secure home page with a clickable link and click
// the link that is not enabled.
linkcheck.setUseAlternativeRenderCheck(false);
authorized.put(SecureComponentHelper.alias(HomePage.class), application.getActionFactory()
.getAction("access render enable"));
authorized.put(SecureComponentHelper.alias(PageA.class), application.getActionFactory()
.getAction("access render"));
login(authorized);