// Path: src/main/java/com/github/davidmoten/logan/config/Configuration.java
// public class Configuration {
// 
//     private static final String DEFAULT_CONFIGURATION_LOCATION = "/logan-configuration.xml";
// 
//     private static Logger log = Logger.getLogger(Configuration.class.getName());
// 
//     /**
//      * Maximum number of log entries to keep in memory. Oldest are discarded
//      * first once size reaches maxSize.
//      */
//     @XmlElement(required = false, defaultValue = "1000000")
//     public int maxSize;
// 
//     @XmlElement(required = false)
//     public String scanDelimiterPattern;
//     
//     @XmlElement(required = false)
//     public PersistenceType persistenceType; 
//     /**
//      * Default parser for log lines for all log files where the parser is not
//      * specified.
//      */
//     @XmlElement(required = false)
//     public Parser parser;
//     /**
//      * Groups of Parser and Log items.
//      */
//     @XmlElement(required = true)
//     public List<Group> group = Lists.newArrayList();
// 
//     /**
//      * Constructor.
//      * 
//      * @param parser
//      *            parser
//      * @param group
//      *            group
//      */
//     public Configuration(Parser parser, List<Group> group) {
//         super();
//         this.parser = parser;
//         this.group = group;
//     }
// 
//     /**
//      * Constructor.
//      */
//     public Configuration() {
//         // no-args constructor required by jaxb
//     }
// 
//     /**
//      * <p>
//      * Returns {@link Configuration} based on the value of the system property
//      * <code>logan.config</code>.
//      * </p>
//      * 
//      * <p>
//      * If <code>logan.config</code> property not set then assumed to be
//      * <code>/logan-configuration.xml</code>.
//      * </p>
//      * 
//      * <p>
//      * Configuration is loaded from the file pointed to by
//      * <code>logan.config</code>. The classpath is checked first then the
//      * filesystem. If the file is not found in neither path then a
//      * {@link RuntimeException} is thrown.
//      * </p>
//      * 
//      * <p>
//      * Any properties specified in the configuration.xml file in the format
//      * <code>${property.name}</code> will be replaced with system properties if
//      * set.
//      * </p>
//      * 
//      * @return loaded configuration
//      */
// 
//     public static synchronized Configuration getConfiguration() {
//         String configLocation = System.getProperty("logan.config", DEFAULT_CONFIGURATION_LOCATION);
//         log.info("config=" + configLocation);
//         InputStream is = Main.class.getResourceAsStream(configLocation);
//         if (is == null) {
//             File file = new File(configLocation);
//             if (file.exists())
//                 try {
//                     is = new FileInputStream(configLocation);
//                 } catch (FileNotFoundException e) {
//                     throw new RuntimeException(e);
//                 }
//             else
//                 throw new RuntimeException(
//                         "configuration xml not found. Set property logan.config to a file on classpath or filesystem.");
//         }
//         InputStream is2 = PropertyReplacer.replaceSystemProperties(is);
//         Configuration configuration = new Marshaller().unmarshal(is2);
//         return configuration;
//     }
// 
//     @Override
//     public String toString() {
//         StringBuilder builder = new StringBuilder();
//         builder.append("Configuration [");
//         builder.append("parser=");
//         builder.append(parser);
//         builder.append("maxSize=");
//         builder.append(maxSize);
//         builder.append(", group=");
//         builder.append(group);
//         builder.append("]");
//         return builder.toString();
//     }
// 
// }
// 
// Path: src/main/java/com/github/davidmoten/logan/config/Marshaller.java
// public class Marshaller {
// 
//     public static final String NAMESPACE = "http://github.com/davidmoten/logan/configuration";
// 
//     private final javax.xml.bind.Marshaller marshaller;
// 
//     private final Unmarshaller unmarshaller;
// 
//     /**
//      * Constructor.
//      */
//     public Marshaller() {
//         try {
//             JAXBContext jc = JAXBContext.newInstance(Configuration.class);
//             marshaller = jc.createMarshaller();
//             marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true);
//             unmarshaller = jc.createUnmarshaller();
//         } catch (PropertyException e) {
//             throw new RuntimeException(e);
//         } catch (JAXBException e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     /**
//      * Marshals {@link Configuration} to xml.
//      * 
//      * @param configuration
//      *            configuration
//      * @param os
//      *            output stream
//      */
//     public synchronized void marshal(Configuration configuration, OutputStream os) {
//         try {
//             JAXBElement<Configuration> element = new JAXBElement<Configuration>(
//                     new QName(NAMESPACE, "configuration"), Configuration.class, configuration);
//             marshaller.marshal(element, os);
//         } catch (JAXBException e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     public synchronized String marshal(Configuration configuration) {
//         ByteArrayOutputStream bytes = new ByteArrayOutputStream();
//         marshal(configuration, bytes);
//         return bytes.toString(StandardCharsets.UTF_8);
//     }
// 
//     /**
//      * Unmarshals xml to {@link Configuration}.
//      * 
//      * @param is
//      *            input stream
//      * @return configuration
//      */
//     public synchronized Configuration unmarshal(InputStream is) {
//         StreamSource xml = new StreamSource(is);
//         JAXBElement<Configuration> element;
//         try {
//             element = unmarshaller.unmarshal(xml, Configuration.class);
//         } catch (JAXBException e) {
//             throw new RuntimeException(e);
//         }
//         return element.getValue();
//     }
// 
// }


import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.github.davidmoten.logan.config.Configuration;
import com.github.davidmoten.logan.config.Marshaller;
package com.github.davidmoten.logan.watcher;




public class ConfigurationLoadTest {

	@Test
	public void testLoadOfSampleConfiguration() {
// Path: src/main/java/com/github/davidmoten/logan/config/Configuration.java
// public class Configuration {
// 
//     private static final String DEFAULT_CONFIGURATION_LOCATION = "/logan-configuration.xml";
// 
//     private static Logger log = Logger.getLogger(Configuration.class.getName());
// 
//     /**
//      * Maximum number of log entries to keep in memory. Oldest are discarded
//      * first once size reaches maxSize.
//      */
//     @XmlElement(required = false, defaultValue = "1000000")
//     public int maxSize;
// 
//     @XmlElement(required = false)
//     public String scanDelimiterPattern;
//     
//     @XmlElement(required = false)
//     public PersistenceType persistenceType; 
//     /**
//      * Default parser for log lines for all log files where the parser is not
//      * specified.
//      */
//     @XmlElement(required = false)
//     public Parser parser;
//     /**
//      * Groups of Parser and Log items.
//      */
//     @XmlElement(required = true)
//     public List<Group> group = Lists.newArrayList();
// 
//     /**
//      * Constructor.
//      * 
//      * @param parser
//      *            parser
//      * @param group
//      *            group
//      */
//     public Configuration(Parser parser, List<Group> group) {
//         super();
//         this.parser = parser;
//         this.group = group;
//     }
// 
//     /**
//      * Constructor.
//      */
//     public Configuration() {
//         // no-args constructor required by jaxb
//     }
// 
//     /**
//      * <p>
//      * Returns {@link Configuration} based on the value of the system property
//      * <code>logan.config</code>.
//      * </p>
//      * 
//      * <p>
//      * If <code>logan.config</code> property not set then assumed to be
//      * <code>/logan-configuration.xml</code>.
//      * </p>
//      * 
//      * <p>
//      * Configuration is loaded from the file pointed to by
//      * <code>logan.config</code>. The classpath is checked first then the
//      * filesystem. If the file is not found in neither path then a
//      * {@link RuntimeException} is thrown.
//      * </p>
//      * 
//      * <p>
//      * Any properties specified in the configuration.xml file in the format
//      * <code>${property.name}</code> will be replaced with system properties if
//      * set.
//      * </p>
//      * 
//      * @return loaded configuration
//      */
// 
//     public static synchronized Configuration getConfiguration() {
//         String configLocation = System.getProperty("logan.config", DEFAULT_CONFIGURATION_LOCATION);
//         log.info("config=" + configLocation);
//         InputStream is = Main.class.getResourceAsStream(configLocation);
//         if (is == null) {
//             File file = new File(configLocation);
//             if (file.exists())
//                 try {
//                     is = new FileInputStream(configLocation);
//                 } catch (FileNotFoundException e) {
//                     throw new RuntimeException(e);
//                 }
//             else
//                 throw new RuntimeException(
//                         "configuration xml not found. Set property logan.config to a file on classpath or filesystem.");
//         }
//         InputStream is2 = PropertyReplacer.replaceSystemProperties(is);
//         Configuration configuration = new Marshaller().unmarshal(is2);
//         return configuration;
//     }
// 
//     @Override
//     public String toString() {
//         StringBuilder builder = new StringBuilder();
//         builder.append("Configuration [");
//         builder.append("parser=");
//         builder.append(parser);
//         builder.append("maxSize=");
//         builder.append(maxSize);
//         builder.append(", group=");
//         builder.append(group);
//         builder.append("]");
//         return builder.toString();
//     }
// 
// }
// 
// Path: src/main/java/com/github/davidmoten/logan/config/Marshaller.java
// public class Marshaller {
// 
//     public static final String NAMESPACE = "http://github.com/davidmoten/logan/configuration";
// 
//     private final javax.xml.bind.Marshaller marshaller;
// 
//     private final Unmarshaller unmarshaller;
// 
//     /**
//      * Constructor.
//      */
//     public Marshaller() {
//         try {
//             JAXBContext jc = JAXBContext.newInstance(Configuration.class);
//             marshaller = jc.createMarshaller();
//             marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true);
//             unmarshaller = jc.createUnmarshaller();
//         } catch (PropertyException e) {
//             throw new RuntimeException(e);
//         } catch (JAXBException e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     /**
//      * Marshals {@link Configuration} to xml.
//      * 
//      * @param configuration
//      *            configuration
//      * @param os
//      *            output stream
//      */
//     public synchronized void marshal(Configuration configuration, OutputStream os) {
//         try {
//             JAXBElement<Configuration> element = new JAXBElement<Configuration>(
//                     new QName(NAMESPACE, "configuration"), Configuration.class, configuration);
//             marshaller.marshal(element, os);
//         } catch (JAXBException e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     public synchronized String marshal(Configuration configuration) {
//         ByteArrayOutputStream bytes = new ByteArrayOutputStream();
//         marshal(configuration, bytes);
//         return bytes.toString(StandardCharsets.UTF_8);
//     }
// 
//     /**
//      * Unmarshals xml to {@link Configuration}.
//      * 
//      * @param is
//      *            input stream
//      * @return configuration
//      */
//     public synchronized Configuration unmarshal(InputStream is) {
//         StreamSource xml = new StreamSource(is);
//         JAXBElement<Configuration> element;
//         try {
//             element = unmarshaller.unmarshal(xml, Configuration.class);
//         } catch (JAXBException e) {
//             throw new RuntimeException(e);
//         }
//         return element.getValue();
//     }
// 
// }


// Path: src/test/java/com/github/davidmoten/logan/watcher/ConfigurationLoadTest.java
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.github.davidmoten.logan.config.Configuration;
import com.github.davidmoten.logan.config.Marshaller;

package com.github.davidmoten.logan.watcher;




public class ConfigurationLoadTest {

	@Test
	public void testLoadOfSampleConfiguration() {
		Configuration configuration = new Marshaller()