use of org.apache.maven.doxia.document.DocumentModel in project maven-plugins by apache.
the class DocumentModelBuilderTest method testGetDocumentModel.
/**
* Test of getDocumentModel method, of class DocumentModelBuilder.
*/
public void testGetDocumentModel() {
DocumentModel model = new DocumentModelBuilder(new ModelBuilderMavenProjectStub()).getDocumentModel();
assertEquals("ISO-8859-1", model.getModelEncoding());
assertEquals("Test ArtifactId", model.getOutputName());
DocumentCover cover = model.getCover();
assertEquals("Test Version", cover.getCoverVersion());
assertEquals("Test Name", cover.getProjectName());
assertEquals("Test Name", cover.getCoverTitle());
assertEquals("v. Test Version", cover.getCoverSubTitle());
assertEquals("Test Organization", cover.getCompanyName());
assertEquals(2, cover.getAuthors().size());
assertFirstDocumentAuthor(cover.getAuthors().get(0));
DocumentMeta meta = model.getMeta();
assertEquals("Test Description", meta.getDescription());
assertEquals(2, meta.getAuthors().size());
assertFirstDocumentAuthor(meta.getAuthors().get(0));
assertEquals("Test Name", meta.getSubject());
assertEquals("Test Name", meta.getTitle());
DocumentTOC toc = model.getToc();
assertEquals(0, toc.getItems().size());
}
use of org.apache.maven.doxia.document.DocumentModel in project maven-plugins by apache.
the class DocumentModelBuilderTest method testEmptyDocumentModel.
/**
* Test of getDocumentModel method, of class DocumentModelBuilder.
*/
public void testEmptyDocumentModel() {
DocumentModel model = new DocumentModelBuilder(null).getDocumentModel();
assertNotNull(model);
assertNull(model.getModelEncoding());
assertEquals("unnamed", model.getOutputName());
assertNotNull(model.getCover());
assertNotNull(model.getMeta());
assertNotNull(model.getToc());
}
use of org.apache.maven.doxia.document.DocumentModel in project maven-plugins by apache.
the class DocumentModelBuilder method getDocumentModel.
// ----------------------------------------------------------------------
// Private methods
// ----------------------------------------------------------------------
/**
* Extract a DocumentModel from a MavenProject.
*
* @param project a MavenProject. May be null.
* @param decorationModel a DecorationModel. May be null.
* @param date the date of the TOC. May be null in which case the build date will be used.
*
* @return a DocumentModel. Always non-null.
*/
private static DocumentModel getDocumentModel(MavenProject project, DecorationModel decorationModel, Date date) {
final Date now = (date == null ? new Date() : date);
final DocumentModel docModel = new DocumentModel();
docModel.setModelEncoding(getProjectModelEncoding(project));
docModel.setOutputName(project == null || project.getArtifactId() == null ? "unnamed" : project.getArtifactId());
docModel.setMeta(getDocumentMeta(project, now));
docModel.setCover(getDocumentCover(project, now));
docModel.setToc(getDocumentTOC(decorationModel));
return docModel;
}
Aggregations