use of org.onehippo.forge.content.pojo.model.ContentNode in project hippo by NHS-digital-website.
the class DatasetTransformerTest method createsContentNodeForABareBonesDatasetWithLinks.
@Test
public void createsContentNodeForABareBonesDatasetWithLinks() {
// * given
DatasetTransformer transformer = buildASimpleDatasetTransformer(listOfThings("resource"), null);
// * when
ContentNode node = transformer.process();
// * then
assertEquals(TITLE, node.getProperty(AbstractTransformer.PUBLICATIONSYSTEM_TITLE_UC).getValue());
assertEquals(SUMMARY, node.getProperty(AbstractTransformer.PUBLICATIONSYSTEM_SUMMARY).getValue());
assertEquals(LONG_DATE, node.getProperty(AbstractTransformer.PUBLICATIONSYSTEM_NOMINALDATE).getValue());
List<ContentNode> nodes = node.getNodes();
assertCountOfNodesIs(nodes, AbstractTransformer.PUBLICATIONSYSTEM_RELATEDLINK, 2);
assertCountOfNodesIs(nodes, AbstractTransformer.PUBLICATION_SYSTEM + "Files-v3", 0);
}
use of org.onehippo.forge.content.pojo.model.ContentNode in project hippo by NHS-digital-website.
the class DatasetTransformerTest method createsContentNodeForADatasetWithAttachmentsAndLinks.
@Test
public void createsContentNodeForADatasetWithAttachmentsAndLinks() {
// * given
DatasetTransformer transformer = buildASimpleDatasetTransformer(listOfThings("resource"), listOfThings("file"));
given(mockStorageManager.uploadFileToS3(any(), any())).willReturn(mockS3ObjectMetaData);
// * when
ContentNode node = transformer.process();
// * then
assertEquals(TITLE, node.getProperty(AbstractTransformer.PUBLICATIONSYSTEM_TITLE_UC).getValue());
assertEquals(SUMMARY, node.getProperty(AbstractTransformer.PUBLICATIONSYSTEM_SUMMARY).getValue());
assertEquals(LONG_DATE, node.getProperty(AbstractTransformer.PUBLICATIONSYSTEM_NOMINALDATE).getValue());
List<ContentNode> nodes = node.getNodes();
assertCountOfNodesIs(nodes, AbstractTransformer.PUBLICATIONSYSTEM_RELATEDLINK, 2);
assertCountOfNodesIs(nodes, AbstractTransformer.PUBLICATIONSYSTEM_EXTATTACHMENT, 2);
}
use of org.onehippo.forge.content.pojo.model.ContentNode in project hippo by NHS-digital-website.
the class DatasetTransformerTest method createsContentNodeForABareBonesDataset.
@Test
public void createsContentNodeForABareBonesDataset() {
// * given
DatasetTransformer transformer = buildASimpleDatasetTransformer(null, null);
// * when
ContentNode node = transformer.process();
// * then
assertEquals(TITLE, node.getProperty(AbstractTransformer.PUBLICATIONSYSTEM_TITLE_UC).getValue());
assertEquals(SUMMARY, node.getProperty(AbstractTransformer.PUBLICATIONSYSTEM_SUMMARY).getValue());
assertEquals(LONG_DATE, node.getProperty(AbstractTransformer.PUBLICATIONSYSTEM_NOMINALDATE).getValue());
assertNull(node.getNode(AbstractTransformer.PUBLICATION_SYSTEM + "Files-v3"));
}
use of org.onehippo.forge.content.pojo.model.ContentNode in project hippo by NHS-digital-website.
the class WebsiteIconListTransformerTest method testExternalLinkCreatesApporopriateNodes.
@Test
public void testExternalLinkCreatesApporopriateNodes() throws RepositoryException {
// given
WebsiteIconListTransformer transformer = getWebsiteIconlistTransformer(false);
// when
ContentNode response = transformer.process();
// then - main node proprties
assertEquals(TITLE, response.getProperty(AbstractSectionTransformer.WEBSITE_TITLE).getValue());
assertEquals(MAIN, response.getProperty(AbstractSectionTransformer.WEBSITE_HEADINGLEVEL).getValue());
// then - introduction node properties
ContentNode introNode = response.getNode(AbstractSectionTransformer.WEBSITE_INTRODUCTION);
assertNotNull(introNode);
// then - item nodes - one per icon list item
assertThereAreExactly(response, AbstractSectionTransformer.WEBSITE_ICONLISTITEMS, 1);
ContentNode iconListItemsNode = assertNodeNotNull(response, AbstractSectionTransformer.WEBSITE_ICONLISTITEMS);
// then - one description per node
ContentNode descrNode = assertNodeNotNull(iconListItemsNode, AbstractSectionTransformer.WEBSITE_DESCRIPTION);
assertEquals(ITEM_DESCRIPTION, descrNode.getProperty(AbstractSectionTransformer.HIPPOSTD_CONTENT).getValue());
// then - one image per node
assertThereAreExactly(iconListItemsNode, AbstractSectionTransformer.WEBSITE_IMAGE, 1);
ContentNode imageNode = assertNodeNotNull(iconListItemsNode, AbstractSectionTransformer.WEBSITE_IMAGE);
assertEquals("abcdef", imageNode.getProperty(AbstractSectionTransformer.HIPPO_DOCBASE).getValue());
assertForExternalLinks(iconListItemsNode);
}
use of org.onehippo.forge.content.pojo.model.ContentNode in project hippo by NHS-digital-website.
the class WebsiteIconListTransformerTest method assertForInternalLinks.
private void assertForInternalLinks(ContentNode iconListItemsNode) {
// then one itemlink per node (or type internal) - which itself contains one link
assertThereAreExactly(iconListItemsNode, AbstractSectionTransformer.WEBSITE_ITEMLINK, 1);
ContentNode itemLinkNode = assertNodeNotNull(iconListItemsNode, AbstractSectionTransformer.WEBSITE_ITEMLINK);
assertEquals(AbstractSectionTransformer.WEBSITE_INTERNALLINK, itemLinkNode.getPrimaryType());
// then - there should be just one link beneath the internal link node
assertThereAreExactly(itemLinkNode, AbstractSectionTransformer.WEBSITE_LINK, 1);
ContentNode linkNode = assertNodeNotNull(itemLinkNode, AbstractSectionTransformer.WEBSITE_LINK);
assertEquals(AbstractSectionTransformer.WEBSITE_INTERNALLINK, itemLinkNode.getPrimaryType());
}
Aggregations