The quick brown fox")); // Now do a body-only one, check that we still got the // contents, but not the html surround def.setParameterValue( HTMLRenderingEngine.PARAM_BODY_CONTENTS_ONLY, Boolean.TRUE ); rendition = renditionService.render(sourceDoc, def); assertNotNull(rendition); htmlNode = rendition.getChildRef(); assertEquals(true, nodeService.exists(htmlNode)); reader = contentService.getReader( htmlNode, ContentModel.PROP_CONTENT ); html = reader.getContentString(); assertEquals("")); assertFalse("Body wrong:\n"+html, html.contains("
")); assertTrue("HTML wrong:\n"+html, html.contains("The quick brown fox")); assertTrue("HTML wrong:\n"+html, html.contains("
")); } /** * Test for a .doc and a .docx, neither of which have images */ public void testDocWithoutImages() throws Exception { def.setParameterValue( RenditionService.PARAM_DESTINATION_PATH_TEMPLATE, targetFolderPath + "/${name}.html" ); for(String name : new String[] {"quick.doc","quick.docx"}) { sourceDoc = createForDoc(name); int numItemsStart = nodeService.getChildAssocs(targetFolder).size(); ChildAssociationRef rendition = renditionService.render(sourceDoc, def); assertNotNull(rendition); // Check it was created NodeRef htmlNode = rendition.getChildRef(); assertEquals(true, nodeService.exists(htmlNode)); // Check it got the right name assertEquals( name.substring(0, name.lastIndexOf('.')) + ".html", nodeService.getProperty(htmlNode, ContentModel.PROP_NAME) ); // Check it ended up in the right place assertEquals( "Should have been in " + targetFolderPath + " but was in" + nodeService.getPath(htmlNode), targetFolder, nodeService.getPrimaryParent(htmlNode).getParentRef() ); // Check it got the right contents ContentReader reader = contentService.getReader( htmlNode, ContentModel.PROP_CONTENT ); String html = reader.getContentString(); assertEquals("