// Path: src/main/java/com/presidentio/testdatagenerator/model/Output.java
// public class Output {
// 
//     private String type;
// 
//     @JsonDeserialize(contentUsing = StringDeserializer.class)
//     private Map<String, String> props;
// 
//     public String getType() {
//         return type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     public Map<String, String> getProps() {
//         return props;
//     }
// 
//     public void setProps(Map<String, String> props) {
//         this.props = props;
//     }
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/model/Schema.java
// public class Schema {
// 
//     private List<Template> templates = new ArrayList<>();
// 
//     private List<String> root = new ArrayList<>();
// 
//     private List<Variable> variables = new ArrayList<>();
// 
//     private Output output;
// 
//     public List<Template> getTemplates() {
//         return templates;
//     }
// 
//     public void setTemplates(List<Template> templates) {
//         this.templates = templates;
//     }
// 
//     public List<String> getRoot() {
//         return root;
//     }
// 
//     public void setRoot(List<String> root) {
//         this.root = root;
//     }
// 
//     public List<Variable> getVariables() {
//         return variables;
//     }
// 
//     public void setVariables(List<Variable> variables) {
//         this.variables = variables;
//     }
// 
//     public Output getOutput() {
//         return output;
//     }
// 
//     public void setOutput(Output output) {
//         this.output = output;
//     }
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/parser/SchemaBuilder.java
// public class SchemaBuilder {
// 
//     private List<Schema> schemas = new ArrayList<>();
// 
//     public SchemaBuilder fromResource(String resource) {
//         SchemaSerializer schemaSerializer = new JsonSchemaSerializer();
//         try {
//             Schema schema = schemaSerializer.deserialize(
//                     SchemaBuilder.class.getClassLoader().getResourceAsStream(resource));
//             schemas.add(schema);
//             return this;
//         } catch (IOException e) {
//             throw new IllegalStateException(e);
//         }
//     }
// 
//     public SchemaBuilder fromFile(String file) {
//         SchemaSerializer schemaSerializer = new JsonSchemaSerializer();
//         try {
//             Schema schema = schemaSerializer.deserialize(new FileInputStream(file));
//             schemas.add(schema);
//             return this;
//         } catch (IOException e) {
//             throw new IllegalStateException(e);
//         }
//     }
// 
//     public Schema build() {
//         Schema schema = null;
//         for (Schema schema1 : schemas) {
//             if (schema == null) {
//                 schema = schema1;
//             } else {
//                 schema = merge(schema, schema1);
//             }
//         }
//         if (schema != null) {
//             for (Template template : schema.getTemplates()) {
//                 if (template.getExtend() != null) {
//                     for (Template parentTemplate : schema.getTemplates()) {
//                         if (parentTemplate.getId().equals(template.getExtend())) {
//                             template.setExtendTemplate(parentTemplate);
//                             break;
//                         }
//                     }
//                 }
//             }
//         }
//         return schema;
//     }
// 
//     private Schema merge(Schema schema1, Schema schema2) {
//         schema1.getTemplates().addAll(schema2.getTemplates());
//         schema1.getRoot().addAll(schema2.getRoot());
//         schema1.getVariables().addAll(schema2.getVariables());
//         if (schema1.getOutput() != null && schema2.getOutput() != null) {
//             throw new IllegalArgumentException("Can't merge two outputs");
//         }
//         if (schema1.getOutput() == null) {
//             schema1.setOutput(schema2.getOutput());
//         }
//         return schema1;
//     }
// 
// }


import com.presidentio.testdatagenerator.model.Output;
import com.presidentio.testdatagenerator.model.Schema;
import com.presidentio.testdatagenerator.parser.SchemaBuilder;
import org.junit.Test;
import java.util.List;
/**
 * 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.presidentio.testdatagenerator;



public abstract class AbstractGeneratorTest {

    protected abstract List<String> getSchemaResource();

    protected OneTimeGenerator buildGenerator() {
        return new OneTimeGenerator();
    }

    @Test
    public void testGenerate() throws Exception {
        SchemaBuilder schemaBuilder = new SchemaBuilder();
        for (String resource : getSchemaResource()) {
            schemaBuilder.fromResource(resource);
        }
// Path: src/main/java/com/presidentio/testdatagenerator/model/Output.java
// public class Output {
// 
//     private String type;
// 
//     @JsonDeserialize(contentUsing = StringDeserializer.class)
//     private Map<String, String> props;
// 
//     public String getType() {
//         return type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     public Map<String, String> getProps() {
//         return props;
//     }
// 
//     public void setProps(Map<String, String> props) {
//         this.props = props;
//     }
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/model/Schema.java
// public class Schema {
// 
//     private List<Template> templates = new ArrayList<>();
// 
//     private List<String> root = new ArrayList<>();
// 
//     private List<Variable> variables = new ArrayList<>();
// 
//     private Output output;
// 
//     public List<Template> getTemplates() {
//         return templates;
//     }
// 
//     public void setTemplates(List<Template> templates) {
//         this.templates = templates;
//     }
// 
//     public List<String> getRoot() {
//         return root;
//     }
// 
//     public void setRoot(List<String> root) {
//         this.root = root;
//     }
// 
//     public List<Variable> getVariables() {
//         return variables;
//     }
// 
//     public void setVariables(List<Variable> variables) {
//         this.variables = variables;
//     }
// 
//     public Output getOutput() {
//         return output;
//     }
// 
//     public void setOutput(Output output) {
//         this.output = output;
//     }
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/parser/SchemaBuilder.java
// public class SchemaBuilder {
// 
//     private List<Schema> schemas = new ArrayList<>();
// 
//     public SchemaBuilder fromResource(String resource) {
//         SchemaSerializer schemaSerializer = new JsonSchemaSerializer();
//         try {
//             Schema schema = schemaSerializer.deserialize(
//                     SchemaBuilder.class.getClassLoader().getResourceAsStream(resource));
//             schemas.add(schema);
//             return this;
//         } catch (IOException e) {
//             throw new IllegalStateException(e);
//         }
//     }
// 
//     public SchemaBuilder fromFile(String file) {
//         SchemaSerializer schemaSerializer = new JsonSchemaSerializer();
//         try {
//             Schema schema = schemaSerializer.deserialize(new FileInputStream(file));
//             schemas.add(schema);
//             return this;
//         } catch (IOException e) {
//             throw new IllegalStateException(e);
//         }
//     }
// 
//     public Schema build() {
//         Schema schema = null;
//         for (Schema schema1 : schemas) {
//             if (schema == null) {
//                 schema = schema1;
//             } else {
//                 schema = merge(schema, schema1);
//             }
//         }
//         if (schema != null) {
//             for (Template template : schema.getTemplates()) {
//                 if (template.getExtend() != null) {
//                     for (Template parentTemplate : schema.getTemplates()) {
//                         if (parentTemplate.getId().equals(template.getExtend())) {
//                             template.setExtendTemplate(parentTemplate);
//                             break;
//                         }
//                     }
//                 }
//             }
//         }
//         return schema;
//     }
// 
//     private Schema merge(Schema schema1, Schema schema2) {
//         schema1.getTemplates().addAll(schema2.getTemplates());
//         schema1.getRoot().addAll(schema2.getRoot());
//         schema1.getVariables().addAll(schema2.getVariables());
//         if (schema1.getOutput() != null && schema2.getOutput() != null) {
//             throw new IllegalArgumentException("Can't merge two outputs");
//         }
//         if (schema1.getOutput() == null) {
//             schema1.setOutput(schema2.getOutput());
//         }
//         return schema1;
//     }
// 
// }


// Path: src/test/java/com/presidentio/testdatagenerator/AbstractGeneratorTest.java
import com.presidentio.testdatagenerator.model.Output;
import com.presidentio.testdatagenerator.model.Schema;
import com.presidentio.testdatagenerator.parser.SchemaBuilder;
import org.junit.Test;
import java.util.List;

/**
 * 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.presidentio.testdatagenerator;



public abstract class AbstractGeneratorTest {

    protected abstract List<String> getSchemaResource();

    protected OneTimeGenerator buildGenerator() {
        return new OneTimeGenerator();
    }

    @Test
    public void testGenerate() throws Exception {
        SchemaBuilder schemaBuilder = new SchemaBuilder();
        for (String resource : getSchemaResource()) {
            schemaBuilder.fromResource(resource);
        }
        Schema schema = schemaBuilder.build();