* test for the openDissectingPane method
*/
public void testOpenDissectingPane() throws RepositoryException {
privateSetUp();
DOMOutputBuffer buffer = new DOMOutputBuffer();
buffer.initialise();
String inclusionPath = "TestInclusionPath";
String paneName = "TestPaneName";
String nextShortcut = "TestNextShardShortcut";
String nextLink = "TestNextShardLink";
String nextClass = "TestNextShardLinkClass";
String prevShortcut = "TestPreviousShardShortcut";
String prevLink = "TestPreviousShardLink";
String prevClass = "TestPreviousShardLinkClass";
String maxContentSize = "100";
boolean nextLinkFirst = true;
DissectingPane pane = new DissectingPane(canvasLayout);
pane.setName(paneName);
pane.setAttribute(FormatConstants.NEXT_SHARD_SHORTCUT_ATTRIBUTE,
nextShortcut);
pane.setAttribute(FormatConstants.NEXT_SHARD_LINK_TEXT_ATTRIBUTE,
nextLink);
pane.setAttribute(FormatConstants.NEXT_SHARD_LINK_CLASS_ATTRIBUTE,
nextClass);
pane.setAttribute(FormatConstants.PREVIOUS_SHARD_SHORTCUT_ATTRIBUTE,
prevShortcut);
pane.setAttribute(FormatConstants.PREVIOUS_SHARD_LINK_TEXT_ATTRIBUTE,
prevLink);
pane.setAttribute(FormatConstants.PREVIOUS_SHARD_LINK_CLASS_ATTRIBUTE,
prevClass);
pane.setAttribute(FormatConstants.MAXIMUM_CONTENT_SIZE_ATTRIBUTE, maxContentSize);
DissectingPaneAttributes atts = new DissectingPaneAttributes();
atts.setDissectingPane(pane);
atts.setInclusionPath(inclusionPath);
atts.setIsNextLinkFirst(nextLinkFirst);
protocol.setDissecting(true);
protocol.openDissectingPane(buffer, atts);
if (protocol.isDissectionSupported()) {
Element el = null;
try {
el = buffer.closeElement
(DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT);
} catch (IllegalStateException ise) {
fail(DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT +
" element not found.");
}
// check that all the attributes have been written out
assertEquals("Invalid inclusion path attribute",
el.getAttributeValue
(DissectionConstants.INCLUSION_PATH_ATTRIBUTE),
atts.getInclusionPath());
assertEquals("Invalid pane name attribute",
el.getAttributeValue
(DissectionConstants.DISSECTING_PANE_NAME_ATTRIBUTE),
atts.getDissectingPane().getName());
assertEquals("Invalid next shard shortcut attribute",
el.getAttributeValue
(DissectionConstants.NEXT_SHARD_SHORTCUT_ATTRIBUTE),
nextShortcut);
assertEquals("Invalid next shard link attribute",
el.getAttributeValue
(DissectionConstants.NEXT_SHARD_LINK_TEXT_ATTRIBUTE),
nextLink);
assertEquals("Invalid previous shortcut attribute",
el.getAttributeValue
(DissectionConstants.PREVIOUS_SHARD_SHORTCUT_ATTRIBUTE),
prevShortcut);
assertEquals("Invalid previous link attribute",
el.getAttributeValue
(DissectionConstants.PREVIOUS_SHARD_LINK_TEXT_ATTRIBUTE),
prevLink);
assertEquals("Invalid next link first attribute",
el.getAttributeValue
(DissectionConstants.GENERATE_NEXT_LINK_FIRST_ATTRIBUTE),
String.valueOf(nextLinkFirst));
assertEquals("Invalid max contents attribute",
el.getAttributeValue
(DissectionConstants.MAXIMUM_CONTENT_SIZE_ATTRIBUTE),
maxContentSize);
} else {
assertTrue("Protocol does not support dissection so no markup " +
"should have been generated", buffer.isEmpty());
}
}