// Path: src/main/java/com/aestasit/markdown/Resources.java
// public static File file(final String filePath) {
//   checkPath(filePath);
//   return new File(filePath);
// }
// 
// Path: src/main/java/com/aestasit/markdown/slidery/configuration/Configuration.java
// public interface Configuration extends ConfigurationBuilder, ConfigurationReader {
// 
// }
// 
// Path: src/main/java/com/aestasit/markdown/slidery/converters/ConverterFactory.java
// public final class ConverterFactory {
// 
//   /**
//    * Lookups <code>&lt;id&gt;.properties</pre></code> under <code>META-INF/slidery-converters</code> directory 
//    * in the class path and based on <code>converter-class</code> property value creates {@link Converter} instance.  
//    * 
//    * @param id converter identifier.
//    * @return converter instance.
//    */
//   public static Converter createConverter(String id) {
//     return doCreateConverter(getConverterClassName(id));
//   }
// 
//   private static Converter doCreateConverter(String converterClassName) {
//     try {
//       Class<?> converterClass = Class.forName(converterClassName);
//       Object converter = converterClass.newInstance();
//       if (!(converter instanceof Converter)) {
//         converter = null;
//       }
//       return (Converter) converter;
//     } catch (ClassNotFoundException e) {
//       throw new RuntimeException(e);
//     } catch (InstantiationException e) {
//       throw new RuntimeException(e);
//     } catch (IllegalAccessException e) {
//       throw new RuntimeException(e);
//     }
//   }
// 
//   private static String getConverterClassName(String id) {
//     try {
//       Properties properties = new Properties();
//       properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/slidery-converters/" + id + ".properties"));
//       String converterClassName = properties.getProperty("converter-class");
//       return converterClassName;
//     } catch (IOException e) {
//       throw new RuntimeException(e);
//     }
//   }
// 
// }
// 
// Path: src/main/java/com/aestasit/markdown/slidery/converters/PdfConverter.java
// public class PdfConverter extends TextTemplateConverter {
// 
//   public static final String CONVERTER_ID = "pdf";
// 
//   protected void beforeStart(final Configuration config) {
//     config
//         .templateFile(classpath("pdf/template.html"))
//         .staticFile("style", classpath("pdf/style/base.css"))
//         .staticFile("style", classpath("pdf/style/code.css"))
//         .staticFile("style", classpath("pdf/style/pdf.css"))
//         .staticFile("style", classpath("pdf/style/reset.css"));
//   }
// 
//   protected void afterConversion(final File joinedInputFile, final Configuration config) {
//     convertToPdf(config.getOutputFile());
//     if (config.isSplitOutput()) {
//       for (final File inputFile : config.getInputFiles()) {
//         convertToPdf(getSplitOutputFile(config.getOutputFile(), inputFile));
//       }
//     }
//     deleteStaticFiles(config);
//   }
// 
//   private void convertToPdf(final File outputFile) {
//     File tempFile = null;
//     try {
//       final ITextRenderer renderer = new ITextRenderer();
//       renderer.setDocument(outputFile);
//       renderer.layout();
//       tempFile = File.createTempFile("slidery", ".pdf");
//       final FileOutputStream outputStream = new FileOutputStream(tempFile);
//       try {
//         renderer.createPDF(outputStream, true);
//       } catch (final DocumentException e) {
//         throw new RuntimeException(e);
//       } finally {
//         closeQuietly(outputStream);
//       }
//       copyFile(tempFile, outputFile);
//     } catch (final IOException e) {
//       throw new RuntimeException(e);
//     } finally {
//       deleteQuietly(tempFile);
//     }
//   }
// 
//   private void deleteStaticFiles(final Configuration config) {
//     final File outputDirectory = config.getOutputFile().getParentFile();
//     for (final Entry<String, File> fileEntry : config.getStaticFiles().entries()) {
//       final String relativePath = fileEntry.getKey();
//       final String fileName = fileEntry.getValue().getName();
//       deleteQuietly(new File(new File(outputDirectory, relativePath), fileName));
//     }
//   }
// 
//   public String getId() {
//     return CONVERTER_ID;
//   }
// 
//   public String getDescription() {
//     return "Basic PDF converter.";
//   }
// 
// }


import static com.aestasit.markdown.Resources.file;
import java.io.IOException;
import org.junit.Test;
import com.aestasit.markdown.slidery.configuration.Configuration;
import com.aestasit.markdown.slidery.converters.ConverterFactory;
import com.aestasit.markdown.slidery.converters.PdfConverter;
/*
 * Copyright (C) 2011-2014 Aestas/IT
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.aestasit.markdown.slidery.converters;





/**
 * @author Andrey Adamovich
 * 
 */
public class PdfConverterTest extends BaseConverterTest {

  @Test
  public void testDirectConversion() throws IOException {
    new PdfConverter().render(createConfiguration());
  }

  @Test
  public void testFactoryConversion() throws IOException {
    ConverterFactory.createConverter(PdfConverter.CONVERTER_ID).render(createConfiguration());
  }

// Path: src/main/java/com/aestasit/markdown/Resources.java
// public static File file(final String filePath) {
//   checkPath(filePath);
//   return new File(filePath);
// }
// 
// Path: src/main/java/com/aestasit/markdown/slidery/configuration/Configuration.java
// public interface Configuration extends ConfigurationBuilder, ConfigurationReader {
// 
// }
// 
// Path: src/main/java/com/aestasit/markdown/slidery/converters/ConverterFactory.java
// public final class ConverterFactory {
// 
//   /**
//    * Lookups <code>&lt;id&gt;.properties</pre></code> under <code>META-INF/slidery-converters</code> directory 
//    * in the class path and based on <code>converter-class</code> property value creates {@link Converter} instance.  
//    * 
//    * @param id converter identifier.
//    * @return converter instance.
//    */
//   public static Converter createConverter(String id) {
//     return doCreateConverter(getConverterClassName(id));
//   }
// 
//   private static Converter doCreateConverter(String converterClassName) {
//     try {
//       Class<?> converterClass = Class.forName(converterClassName);
//       Object converter = converterClass.newInstance();
//       if (!(converter instanceof Converter)) {
//         converter = null;
//       }
//       return (Converter) converter;
//     } catch (ClassNotFoundException e) {
//       throw new RuntimeException(e);
//     } catch (InstantiationException e) {
//       throw new RuntimeException(e);
//     } catch (IllegalAccessException e) {
//       throw new RuntimeException(e);
//     }
//   }
// 
//   private static String getConverterClassName(String id) {
//     try {
//       Properties properties = new Properties();
//       properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/slidery-converters/" + id + ".properties"));
//       String converterClassName = properties.getProperty("converter-class");
//       return converterClassName;
//     } catch (IOException e) {
//       throw new RuntimeException(e);
//     }
//   }
// 
// }
// 
// Path: src/main/java/com/aestasit/markdown/slidery/converters/PdfConverter.java
// public class PdfConverter extends TextTemplateConverter {
// 
//   public static final String CONVERTER_ID = "pdf";
// 
//   protected void beforeStart(final Configuration config) {
//     config
//         .templateFile(classpath("pdf/template.html"))
//         .staticFile("style", classpath("pdf/style/base.css"))
//         .staticFile("style", classpath("pdf/style/code.css"))
//         .staticFile("style", classpath("pdf/style/pdf.css"))
//         .staticFile("style", classpath("pdf/style/reset.css"));
//   }
// 
//   protected void afterConversion(final File joinedInputFile, final Configuration config) {
//     convertToPdf(config.getOutputFile());
//     if (config.isSplitOutput()) {
//       for (final File inputFile : config.getInputFiles()) {
//         convertToPdf(getSplitOutputFile(config.getOutputFile(), inputFile));
//       }
//     }
//     deleteStaticFiles(config);
//   }
// 
//   private void convertToPdf(final File outputFile) {
//     File tempFile = null;
//     try {
//       final ITextRenderer renderer = new ITextRenderer();
//       renderer.setDocument(outputFile);
//       renderer.layout();
//       tempFile = File.createTempFile("slidery", ".pdf");
//       final FileOutputStream outputStream = new FileOutputStream(tempFile);
//       try {
//         renderer.createPDF(outputStream, true);
//       } catch (final DocumentException e) {
//         throw new RuntimeException(e);
//       } finally {
//         closeQuietly(outputStream);
//       }
//       copyFile(tempFile, outputFile);
//     } catch (final IOException e) {
//       throw new RuntimeException(e);
//     } finally {
//       deleteQuietly(tempFile);
//     }
//   }
// 
//   private void deleteStaticFiles(final Configuration config) {
//     final File outputDirectory = config.getOutputFile().getParentFile();
//     for (final Entry<String, File> fileEntry : config.getStaticFiles().entries()) {
//       final String relativePath = fileEntry.getKey();
//       final String fileName = fileEntry.getValue().getName();
//       deleteQuietly(new File(new File(outputDirectory, relativePath), fileName));
//     }
//   }
// 
//   public String getId() {
//     return CONVERTER_ID;
//   }
// 
//   public String getDescription() {
//     return "Basic PDF converter.";
//   }
// 
// }


// Path: src/test/java/com/aestasit/markdown/slidery/converters/PdfConverterTest.java
import static com.aestasit.markdown.Resources.file;
import java.io.IOException;
import org.junit.Test;
import com.aestasit.markdown.slidery.configuration.Configuration;
import com.aestasit.markdown.slidery.converters.ConverterFactory;
import com.aestasit.markdown.slidery.converters.PdfConverter;

/*
 * Copyright (C) 2011-2014 Aestas/IT
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.aestasit.markdown.slidery.converters;





/**
 * @author Andrey Adamovich
 * 
 */
public class PdfConverterTest extends BaseConverterTest {

  @Test
  public void testDirectConversion() throws IOException {
    new PdfConverter().render(createConfiguration());
  }

  @Test
  public void testFactoryConversion() throws IOException {
    ConverterFactory.createConverter(PdfConverter.CONVERTER_ID).render(createConfiguration());
  }

  @Override