velocityCtx.put("hasCustomWorkflows", hasCustomWorkflows(topology)); velocityCtx.put("generateWorkflow", generateWorkflow); if (csar.getDescription() == null) { velocityCtx.put("template_description", ""); } else { velocityCtx.put("template_description", csar.getDescription());
if (StringUtils.isEmpty(topology.getDescription()) && StringUtils.isNotEmpty(archiveRoot.getArchive().getDescription())) { topology.setDescription(archiveRoot.getArchive().getDescription());
@Test public void testDescriptionSingleLine() throws FileNotFoundException, ParsingException { ParsingResult<ArchiveRoot> parsingResult = parser.parseFile(Paths.get(getRootDirectory(), "description-single-line.yml")); Assert.assertEquals(0, parsingResult.getContext().getParsingErrors().size()); ArchiveRoot archiveRoot = parsingResult.getResult(); assertNotNull(archiveRoot.getArchive()); Assert.assertEquals(getToscaVersion(), archiveRoot.getArchive().getToscaDefinitionsVersion()); assertNotNull(archiveRoot.getArchive().getDescription()); Assert.assertEquals("This is an example of a single line description (no folding).", archiveRoot.getArchive().getDescription()); }
@Test public void testDescriptionMultiLine() throws FileNotFoundException, ParsingException { ParsingResult<ArchiveRoot> parsingResult = parser.parseFile(Paths.get(getRootDirectory(), "description-multi-line.yml")); Assert.assertEquals(0, parsingResult.getContext().getParsingErrors().size()); ArchiveRoot archiveRoot = parsingResult.getResult(); assertNotNull(archiveRoot.getArchive()); Assert.assertEquals(getToscaVersion(), archiveRoot.getArchive().getToscaDefinitionsVersion()); assertNotNull(archiveRoot.getArchive().getDescription()); Assert.assertEquals( "This is an example of a multi-line description using YAML. It permits for line breaks for easier readability...\nif needed. However, (multiple) line breaks are folded into a single space character when processed into a single string value.", archiveRoot.getArchive().getDescription()); }
EditionContextManager.get().getCsar().setDescription(parsingResult.getResult().getArchive().getDescription());
@Test public void testRootCategories() throws FileNotFoundException, ParsingException { ParsingResult<ArchiveRoot> parsingResult = parser.parseFile(Paths.get(getRootDirectory(), "tosca-root-categories.yml")); assertNoBlocker(parsingResult); ArchiveRoot archiveRoot = parsingResult.getResult(); assertNotNull(archiveRoot.getArchive()); Assert.assertEquals(getToscaVersion(), archiveRoot.getArchive().getToscaDefinitionsVersion()); Assert.assertEquals("Tosca default namespace value", archiveRoot.getArchive().getToscaDefaultNamespace()); Assert.assertEquals("Template name value", archiveRoot.getArchive().getName()); Assert.assertEquals("Temlate author value", archiveRoot.getArchive().getTemplateAuthor()); Assert.assertEquals("1.0.0-SNAPSHOT", archiveRoot.getArchive().getVersion()); Assert.assertEquals("This is an example of a single line description (no folding).", archiveRoot.getArchive().getDescription()); }