use of org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMAttributeDeclarationImpl in project webtools.sourceediting by eclipse.
the class TestTaglibCMTests method testTagRuntimeExpressionValues.
public void testTagRuntimeExpressionValues() throws Exception {
final String testName = "testLoadTagFiles";
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName);
if (!project.exists()) {
project = BundleResourceUtil.createSimpleProject(testName, null, null);
BundleResourceUtil.copyBundleEntriesIntoWorkspace(TESTFILES_PATHSTRING + testName, "/" + testName);
}
project.refreshLocal(IResource.DEPTH_INFINITE, null);
CMDocumentFactoryTLD factory = new CMDocumentFactoryTLD();
ITaglibRecord[] records = TaglibIndex.getAvailableTaglibRecords(new Path("/" + testName + "/"));
assertEquals("There should only be one taglib record", 1, records.length);
CMDocument document = factory.createCMDocument(records[0]);
CMNamedNodeMap elements = document.getElements();
assertNotNull("No elements for the CM Document", elements);
CMNode node = elements.getNamedItem("test");
assertTrue("Node must be a CMElementDeclarationImpl", node instanceof CMElementDeclarationImpl);
CMNamedNodeMap attributes = ((CMElementDeclaration) node).getAttributes();
assertNotNull("No attributes", attributes);
node = attributes.getNamedItem("myAttr");
assertTrue("Node must be a CMAttributeDeclarationImpl", node instanceof CMAttributeDeclarationImpl);
assertEquals("Default rtexprvalue for tags should be true", JSP11Namespace.ATTR_VALUE_TRUE, ((CMAttributeDeclarationImpl) node).getRtexprvalue());
node = attributes.getNamedItem("noRuntimeAttr");
assertTrue("Node must be a CMAttributeDeclarationImpl", node instanceof CMAttributeDeclarationImpl);
assertEquals("rtexprvalue for should be false since explicitly set", JSP11Namespace.ATTR_VALUE_FALSE, ((CMAttributeDeclarationImpl) node).getRtexprvalue());
}
Aggregations