// Path: templates/src/main/java/de/ubleipzig/iiifproducer/template/ManifestSerializer.java
// public static Optional<String> serialize(final Object manifest) {
//     try {
//         return of(MAPPER.writer(PrettyPrinter.instance).writeValueAsString(manifest));
//     } catch (final JsonProcessingException ex) {
//         return empty();
//     }
// }
// 
// Path: templates/src/main/java/de/ubleipzig/iiifproducer/template/TemplateManifest.java
// @JsonInclude(Include.NON_NULL)
// @JsonPropertyOrder({"@context", "@id", "@type", "label", "license", "attribution", "logo", "related", "metadata",
//         "sequences", "structures"})
// public class TemplateManifest {
// 
//     @JsonProperty("@context")
//     private String context;
// 
//     @JsonProperty("@id")
//     private String id;
// 
//     @JsonProperty("@type")
//     private String type = SCEnum.Manifest.compactedIRI();
// 
//     @JsonProperty("label")
//     private String label = "unnamed";
// 
//     @JsonProperty("license")
//     private String license;
// 
//     @JsonProperty("attribution")
//     private String attribution;
// 
//     @JsonProperty("logo")
//     private String logo;
// 
//     @JsonProperty("related")
//     private List<String> related;
// 
//     @JsonProperty("metadata")
//     private List<TemplateMetadata> metadata;
// 
//     @JsonProperty("sequences")
//     private List<TemplateSequence> sequences;
// 
//     @JsonProperty("structures")
//     private List<TemplateStructure> structures;
// 
//     /**
//      * TemplateManifest.
//      */
//     public TemplateManifest() {
//     }
// 
//     /**
//      * @param context String
//      */
//     public void setContext(final String context) {
//         this.context = context;
//     }
// 
//     /**
//      * @param id String
//      */
//     public void setId(final String id) {
//         this.id = id;
//     }
// 
//     /**
//      * @param type String
//      */
//     public void setType(final String type) {
//         this.type = type;
//     }
// 
//     /**
//      * @param label String
//      */
//     public void setLabel(final String label) {
//         this.label = label;
//     }
// 
//     /**
//      * @param license String
//      */
//     public void setLicense(final String license) {
//         this.license = license;
//     }
// 
//     /**
//      * @param attribution String
//      */
//     public void setAttribution(final String attribution) {
//         this.attribution = attribution;
//     }
// 
//     /**
//      * @param logo String
//      */
//     public void setLogo(final String logo) {
//         this.logo = logo;
//     }
// 
//     /**
//      * @param related List
//      */
//     public void setRelated(final List<String> related) {
//         this.related = related;
//     }
// 
//     /**
//      * @param sequences List
//      */
//     public void setSequences(final List<TemplateSequence> sequences) {
//         this.sequences = sequences;
//     }
// 
//     /**
//      * @param metadata List
//      */
//     public void setMetadata(final List<TemplateMetadata> metadata) {
//         this.metadata = metadata;
//     }
// 
//     /**
//      * @return List
//      */
//     public List<TemplateStructure> getStructures() {
//         return this.structures;
//     }
// 
//     /**
//      * @param structures List
//      */
//     public void setStructures(final List<TemplateStructure> structures) {
//         this.structures = structures;
//     }
// }


import static de.ubleipzig.iiifproducer.template.ManifestSerializer.serialize;
import static java.lang.System.out;
import static java.nio.file.Paths.get;
import static org.junit.jupiter.api.Assertions.assertTrue;
import de.ubleipzig.iiifproducer.template.TemplateManifest;
import java.util.Optional;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
/*
 * IIIFProducer
 * Copyright (C) 2017 Leipzig University Library <info@ub.uni-leipzig.de>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */

package de.ubleipzig.iiifproducer.producer;





/**
 * SetNullableMetadataTest.
 *
 * @author christopher-johnson
 */
public class SetNullableMetadataTest {

    private static String sourceFile;

    @BeforeAll
    static void setup() {
        sourceFile = SetNullableMetadataTest.class.getResource("/BlhDie_004285964.xml").getPath();
    }

    @Test
    void testSetManuscriptMetadata() {
        final Config config = new Config();
        config.setXmlFile(sourceFile);
        config.setOutputFile("/tmp/test.json");
        config.setViewId("004285964");
        final MetsAccessor mets = new MetsImpl(config);
        final TemplateManifest body = new TemplateManifest();
        mets.setHandschriftMetadata(body);
        final Optional<String> json = serialize(body);
        assertTrue(json.isPresent());
        out.println(json.get());
    }

    @Test
    void testSetMetadata() {
        final Config config = new Config();
        config.setXmlFile(sourceFile);
        config.setOutputFile("/tmp/test.json");
        config.setViewId("004285964");
        final MetsAccessor mets = new MetsImpl(config);
// Path: templates/src/main/java/de/ubleipzig/iiifproducer/template/ManifestSerializer.java
// public static Optional<String> serialize(final Object manifest) {
//     try {
//         return of(MAPPER.writer(PrettyPrinter.instance).writeValueAsString(manifest));
//     } catch (final JsonProcessingException ex) {
//         return empty();
//     }
// }
// 
// Path: templates/src/main/java/de/ubleipzig/iiifproducer/template/TemplateManifest.java
// @JsonInclude(Include.NON_NULL)
// @JsonPropertyOrder({"@context", "@id", "@type", "label", "license", "attribution", "logo", "related", "metadata",
//         "sequences", "structures"})
// public class TemplateManifest {
// 
//     @JsonProperty("@context")
//     private String context;
// 
//     @JsonProperty("@id")
//     private String id;
// 
//     @JsonProperty("@type")
//     private String type = SCEnum.Manifest.compactedIRI();
// 
//     @JsonProperty("label")
//     private String label = "unnamed";
// 
//     @JsonProperty("license")
//     private String license;
// 
//     @JsonProperty("attribution")
//     private String attribution;
// 
//     @JsonProperty("logo")
//     private String logo;
// 
//     @JsonProperty("related")
//     private List<String> related;
// 
//     @JsonProperty("metadata")
//     private List<TemplateMetadata> metadata;
// 
//     @JsonProperty("sequences")
//     private List<TemplateSequence> sequences;
// 
//     @JsonProperty("structures")
//     private List<TemplateStructure> structures;
// 
//     /**
//      * TemplateManifest.
//      */
//     public TemplateManifest() {
//     }
// 
//     /**
//      * @param context String
//      */
//     public void setContext(final String context) {
//         this.context = context;
//     }
// 
//     /**
//      * @param id String
//      */
//     public void setId(final String id) {
//         this.id = id;
//     }
// 
//     /**
//      * @param type String
//      */
//     public void setType(final String type) {
//         this.type = type;
//     }
// 
//     /**
//      * @param label String
//      */
//     public void setLabel(final String label) {
//         this.label = label;
//     }
// 
//     /**
//      * @param license String
//      */
//     public void setLicense(final String license) {
//         this.license = license;
//     }
// 
//     /**
//      * @param attribution String
//      */
//     public void setAttribution(final String attribution) {
//         this.attribution = attribution;
//     }
// 
//     /**
//      * @param logo String
//      */
//     public void setLogo(final String logo) {
//         this.logo = logo;
//     }
// 
//     /**
//      * @param related List
//      */
//     public void setRelated(final List<String> related) {
//         this.related = related;
//     }
// 
//     /**
//      * @param sequences List
//      */
//     public void setSequences(final List<TemplateSequence> sequences) {
//         this.sequences = sequences;
//     }
// 
//     /**
//      * @param metadata List
//      */
//     public void setMetadata(final List<TemplateMetadata> metadata) {
//         this.metadata = metadata;
//     }
// 
//     /**
//      * @return List
//      */
//     public List<TemplateStructure> getStructures() {
//         return this.structures;
//     }
// 
//     /**
//      * @param structures List
//      */
//     public void setStructures(final List<TemplateStructure> structures) {
//         this.structures = structures;
//     }
// }


// Path: producer/src/test/java/de/ubleipzig/iiifproducer/producer/SetNullableMetadataTest.java
import static de.ubleipzig.iiifproducer.template.ManifestSerializer.serialize;
import static java.lang.System.out;
import static java.nio.file.Paths.get;
import static org.junit.jupiter.api.Assertions.assertTrue;
import de.ubleipzig.iiifproducer.template.TemplateManifest;
import java.util.Optional;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

/*
 * IIIFProducer
 * Copyright (C) 2017 Leipzig University Library <info@ub.uni-leipzig.de>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */

package de.ubleipzig.iiifproducer.producer;





/**
 * SetNullableMetadataTest.
 *
 * @author christopher-johnson
 */
public class SetNullableMetadataTest {

    private static String sourceFile;

    @BeforeAll
    static void setup() {
        sourceFile = SetNullableMetadataTest.class.getResource("/BlhDie_004285964.xml").getPath();
    }

    @Test
    void testSetManuscriptMetadata() {
        final Config config = new Config();
        config.setXmlFile(sourceFile);
        config.setOutputFile("/tmp/test.json");
        config.setViewId("004285964");
        final MetsAccessor mets = new MetsImpl(config);
        final TemplateManifest body = new TemplateManifest();
        mets.setHandschriftMetadata(body);
        final Optional<String> json = serialize(body);
        assertTrue(json.isPresent());
        out.println(json.get());
    }

    @Test
    void testSetMetadata() {
        final Config config = new Config();
        config.setXmlFile(sourceFile);
        config.setOutputFile("/tmp/test.json");
        config.setViewId("004285964");
        final MetsAccessor mets = new MetsImpl(config);
        final TemplateManifest body = new TemplateManifest();