use of org.dom4j.Node in project core by craftercms.
the class TemplateProcessorTest method testProcess.
@Test
public void testProcess() throws Exception {
item = processor.process(null, null, item);
assertNotNull(item.getDescriptorDom());
Node body = item.getDescriptorDom().selectSingleNode("/root/body");
assertNotNull(body);
assertEquals(BODY_MODEL_VALUE, body.getText());
}
use of org.dom4j.Node in project core by craftercms.
the class TextMetaDataExtractingProcessorTest method setUpTestItem.
private void setUpTestItem() {
Node cssNode = mock(Node.class);
when(cssNode.getText()).thenReturn(CSS);
Node jsNode = mock(Node.class);
when(jsNode.getText()).thenReturn(JS);
Document descriptorDom = mock(Document.class);
when(descriptorDom.selectSingleNode(testMetaDataNodesXPathQueries[0])).thenReturn(cssNode);
when(descriptorDom.selectSingleNode(testMetaDataNodesXPathQueries[1])).thenReturn(jsNode);
item = new Item();
item.setDescriptorDom(descriptorDom);
}
use of org.dom4j.Node in project core by craftercms.
the class ContentStoreServiceImplTest method assertContentFrEsDescriptorItem.
private void assertContentFrEsDescriptorItem(Item item, boolean processorSpecified) {
assertNotNull(item);
assertEquals(CONTENT_FR_ES_DESCRIPTOR_NAME, item.getName());
assertEquals(CONTENT_FR_ES_DESCRIPTOR_PATH, item.getUrl());
assertFalse(item.isFolder());
assertEquals(CONTENT_FR_ES_DESCRIPTOR_PATH, item.getDescriptorUrl());
assertNotNull(item.getDescriptorDom());
assertSystemInfoProperties(item);
if (processorSpecified) {
assertEquals(FIRST_QUOTE_EN, item.getProperty("//first-quote"));
assertEquals(SECOND_QUOTE_FR, item.getProperty("//second-quote"));
assertEquals(THIRD_QUOTE_ES, item.getProperty("//third-quote"));
} else {
Node firstQuote = item.getDescriptorDom().selectSingleNode("//first-quote");
assertNotNull(firstQuote);
assertEquals(FIRST_QUOTE_EN, firstQuote.getText());
Node secondQuote = item.getDescriptorDom().selectSingleNode("//second-quote");
assertNotNull(secondQuote);
assertEquals(SECOND_QUOTE_FR, secondQuote.getText());
Node thirdQuote = item.getDescriptorDom().selectSingleNode("//third-quote");
assertNotNull(thirdQuote);
assertEquals(THIRD_QUOTE_ES, thirdQuote.getText());
}
}
use of org.dom4j.Node in project core by craftercms.
the class ContentStoreServiceImplTest method assertCrafterCMSLogoItem.
private void assertCrafterCMSLogoItem(Item item, boolean processorSpecified) {
assertNotNull(item);
assertEquals(CRAFTER_CMS_LOGO_NAME, item.getName());
assertEquals(CRAFTER_CMS_LOGO_PATH, item.getUrl());
assertFalse(item.isFolder());
assertEquals(CRAFTER_CMS_LOGO_META_FILE_PATH, item.getDescriptorUrl());
assertNotNull(item.getDescriptorDom());
assertSystemInfoProperties(item);
assertEquals(CRAFTER_CMS_LOGO_RESOLUTION_WIDTH, Integer.parseInt((String) item.getProperty("//resolution/width")));
assertEquals(CRAFTER_CMS_LOGO_RESOLUTION_HEIGHT, Integer.parseInt((String) item.getProperty("//resolution/height")));
if (processorSpecified) {
String size = (String) item.getProperty("//size");
assertEquals(CRAFTER_CMS_LOGO_SIZE, size);
} else {
Node size = item.getDescriptorDom().selectSingleNode("//size");
assertNotNull(size);
assertEquals(CRAFTER_CMS_LOGO_SIZE, size.getText());
}
}
use of org.dom4j.Node in project core by craftercms.
the class ContentStoreServiceImplTest method assertContentDescriptorItem.
private void assertContentDescriptorItem(Item item, boolean processorSpecified) {
assertNotNull(item);
assertEquals(CONTENT_DESCRIPTOR_NAME, item.getName());
assertEquals(CONTENT_DESCRIPTOR_PATH, item.getUrl());
assertFalse(item.isFolder());
assertEquals(CONTENT_DESCRIPTOR_PATH, item.getDescriptorUrl());
assertNotNull(item.getDescriptorDom());
assertSystemInfoProperties(item);
if (processorSpecified) {
assertEquals(FIRST_QUOTE_EN, item.getProperty("//first-quote"));
assertEquals(SECOND_QUOTE_EN, item.getProperty("//second-quote"));
assertEquals(THIRD_QUOTE_EN, item.getProperty("//third-quote"));
} else {
Node firstQuote = item.getDescriptorDom().selectSingleNode("//first-quote");
assertNotNull(firstQuote);
assertEquals(FIRST_QUOTE_EN, firstQuote.getText());
Node secondQuote = item.getDescriptorDom().selectSingleNode("//second-quote");
assertNotNull(secondQuote);
assertEquals(SECOND_QUOTE_EN, secondQuote.getText());
Node thirdQuote = item.getDescriptorDom().selectSingleNode("//third-quote");
assertNotNull(thirdQuote);
assertEquals(THIRD_QUOTE_EN, thirdQuote.getText());
}
}
Aggregations