@Test public void testYamlBean2Yaml() throws Exception { final ServiceTemplate element = new ServiceTemplate(); final String yamlSpec = "yaml_spec_123"; element.setTosca_definitions_version(yamlSpec); final String output = this.converter.convertToYaml(element); Assert.assertNotNull(output); Assert.assertTrue(output.contains(yamlSpec)); }
@Override public String convertToYaml(YAMLElement yamlRoot) throws ConverterException { if (yamlRoot == null) { throw new IllegalArgumentException("Root element may not be null!"); } final Writer output = new StringWriter(); final YamlWriter writer = new YamlWriter(output); adjustConfig(writer.getConfig()); try { writer.write(yamlRoot); writer.close(); } catch (final YamlException e) { throw new ConverterException(e); } return output.toString(); }
YamlBeansConverter implements IToscaYaml2YamlBeanConverter { @Override public String convertToYaml(YAMLElement yamlRoot) throws ConverterException { if (yamlRoot == null) { throw new IllegalArgumentException("Root element may not be null!"); } final Writer output = new StringWriter(); final YamlWriter writer = new YamlWriter(output); adjustConfig(writer.getConfig()); try { writer.write(yamlRoot); writer.close(); } catch (final YamlException e) { throw new ConverterException(e); } return output.toString(); } }
YamlBeansConverter implements IToscaYaml2YamlBeanConverter { @Override public String convertToYaml(YAMLElement yamlRoot) throws ConverterException { if (yamlRoot == null) { throw new IllegalArgumentException("Root element may not be null!"); } final Writer output = new StringWriter(); final YamlWriter writer = new YamlWriter(output); adjustConfig(writer.getConfig()); try { writer.write(yamlRoot); writer.close(); } catch (final YamlException e) { throw new ConverterException(e); } return output.toString(); }  }
YamlBeansConverter implements IToscaYaml2YamlBeanConverter { @Override public String convertToYaml(YAMLElement yamlRoot) throws ConverterException { if (yamlRoot == null) { throw new IllegalArgumentException("Root element may not be null!"); } final Writer output = new StringWriter(); final YamlWriter writer = new YamlWriter(output); adjustConfig(writer.getConfig()); try { writer.write(yamlRoot); writer.close(); } catch (final YamlException e) { throw new ConverterException(e); } return output.toString(); }  @Override ServiceTemplate convertToYamlBean(String yamlString); @Override String convertToYaml(YAMLElement yamlRoot); }
YamlBeansConverter implements IToscaYaml2YamlBeanConverter { @Override public String convertToYaml(YAMLElement yamlRoot) throws ConverterException { if (yamlRoot == null) { throw new IllegalArgumentException("Root element may not be null!"); } final Writer output = new StringWriter(); final YamlWriter writer = new YamlWriter(output); adjustConfig(writer.getConfig()); try { writer.write(yamlRoot); writer.close(); } catch (final YamlException e) { throw new ConverterException(e); } return output.toString(); }  @Override ServiceTemplate convertToYamlBean(String yamlString); @Override String convertToYaml(YAMLElement yamlRoot);  }