// Path: graphql-cayenne/src/main/java/org/objectstyle/graphql/cayenne/orm/DefaultSchemaTranslator.java
// public class DefaultSchemaTranslator implements SchemaTranslator {
// 
//     private ObjectContext selectContext;
// 
//     public DefaultSchemaTranslator(ObjectContext selectContext) {
//         this.selectContext = selectContext;
//     }
// 
//     @Override
//     public GraphQLSchema toGraphQL() {
//         return SchemaBuilder.builder(selectContext).mutationType(MutationType.builder(selectContext).build())
//                 .build();
//     }
// }
// 
// Path: graphql-cayenne/src/main/java/org/objectstyle/graphql/cayenne/orm/SchemaTranslator.java
// public interface SchemaTranslator {
// 
// 	GraphQLSchema toGraphQL();
// }
// 
// Path: graphql-test/src/main/java/org/objectstyle/graphql/test/TestFactory.java
// public class TestFactory {
// 
//     private ServerRuntime serverRuntime;
//     private ObjectContext objectContext;
// 
//     public TestFactory(){
//         createServerRuntime();
//     }
// 
//     private void createServerRuntime() {
//         removeDerbyDirectory();
// 
//         serverRuntime = ServerRuntimeBuilder.builder().addConfig("cayenne-tests.xml")
//                 .url("jdbc:derby:target/derby;create=true").jdbcDriver("org.apache.derby.jdbc.EmbeddedDriver")
//                 .addModule(cayenneExtensions()).build();
// 
//         objectContext = serverRuntime.newContext();
// 
//         insertTestData();
//     }
// 
//     public void stopServerRuntime() {
//         serverRuntime.shutdown();
//         serverRuntime = null;
// 
//         stopDerby();
//     }
// 
//     private static org.apache.cayenne.di.Module cayenneExtensions() {
//         return (b) -> b.bind(SchemaUpdateStrategy.class).to(CreateIfNoSchemaStrategy.class);
//     }
// 
//     private void insertTestData() {
//         insert("e1", "id, name", "1, 'a'");
//         insert("e1", "id, name", "2, 'b'");
// 
//         insert("e2", "id, name, e1_id", "3, 'c', 1");
//         insert("e2", "id, name, e1_id", "4, 'd', 2");
//         insert("e2", "id, name, e1_id", "5, 'e', 2");
// 
//         insert("e3", "id, name, e2_id", "6, 'f', 4");
//         insert("e3", "id, name, e2_id", "7, 'g', 4");
//         insert("e3", "id, name, e2_id", "8, 'h', 5");
//     }
// 
//     private void insert(String table, String columns, String values) {
//         String insertSql = "INSERT INTO utest." + table + " (" + columns + ") VALUES (" + values + ")";
//         objectContext.performGenericQuery(new SQLTemplate(table, insertSql));
//     }
// 
//     private void removeDerbyDirectory() {
// 
//         File derbyDir = new File("target/derby");
//         if (derbyDir.isDirectory()) {
//             try {
//                 FileUtils.deleteDirectory(derbyDir);
//             } catch (IOException e) {
//                 throw new RuntimeException(e);
//             }
//         }
//     }
// 
//     private void stopDerby() {
//         try {
//             DriverManager.getConnection("jdbc:derby:;shutdown=true");
//         } catch (SQLException ignored) {
//         }
//     }
// 
//     public ObjectContext getObjectContext() {
//         return objectContext;
//     }
// 
//     public ServerRuntime getServerRuntime() {
//         return serverRuntime;
//     }
// }


import com.fasterxml.jackson.databind.ObjectMapper;
import graphql.GraphQL;
import org.junit.AfterClass;
import org.objectstyle.graphql.cayenne.orm.DefaultSchemaTranslator;
import org.objectstyle.graphql.cayenne.orm.SchemaTranslator;
import org.objectstyle.graphql.test.TestFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.HashMap;
package org.objectstyle.graphql.cayenne.it;



class GraphQLTestFactory {
    private static GraphQL graphQL;
    private static TestFactory testFactory = new TestFactory();
    private static final Logger LOGGER = LoggerFactory.getLogger(GraphQLTestFactory.class);

    GraphQLTestFactory() {
        graphQL = createGraphQL(createSchemaTranslator());
    }

    @AfterClass
    public static void tearDownClass() {
        testFactory.stopServerRuntime();
    }

// Path: graphql-cayenne/src/main/java/org/objectstyle/graphql/cayenne/orm/DefaultSchemaTranslator.java
// public class DefaultSchemaTranslator implements SchemaTranslator {
// 
//     private ObjectContext selectContext;
// 
//     public DefaultSchemaTranslator(ObjectContext selectContext) {
//         this.selectContext = selectContext;
//     }
// 
//     @Override
//     public GraphQLSchema toGraphQL() {
//         return SchemaBuilder.builder(selectContext).mutationType(MutationType.builder(selectContext).build())
//                 .build();
//     }
// }
// 
// Path: graphql-cayenne/src/main/java/org/objectstyle/graphql/cayenne/orm/SchemaTranslator.java
// public interface SchemaTranslator {
// 
// 	GraphQLSchema toGraphQL();
// }
// 
// Path: graphql-test/src/main/java/org/objectstyle/graphql/test/TestFactory.java
// public class TestFactory {
// 
//     private ServerRuntime serverRuntime;
//     private ObjectContext objectContext;
// 
//     public TestFactory(){
//         createServerRuntime();
//     }
// 
//     private void createServerRuntime() {
//         removeDerbyDirectory();
// 
//         serverRuntime = ServerRuntimeBuilder.builder().addConfig("cayenne-tests.xml")
//                 .url("jdbc:derby:target/derby;create=true").jdbcDriver("org.apache.derby.jdbc.EmbeddedDriver")
//                 .addModule(cayenneExtensions()).build();
// 
//         objectContext = serverRuntime.newContext();
// 
//         insertTestData();
//     }
// 
//     public void stopServerRuntime() {
//         serverRuntime.shutdown();
//         serverRuntime = null;
// 
//         stopDerby();
//     }
// 
//     private static org.apache.cayenne.di.Module cayenneExtensions() {
//         return (b) -> b.bind(SchemaUpdateStrategy.class).to(CreateIfNoSchemaStrategy.class);
//     }
// 
//     private void insertTestData() {
//         insert("e1", "id, name", "1, 'a'");
//         insert("e1", "id, name", "2, 'b'");
// 
//         insert("e2", "id, name, e1_id", "3, 'c', 1");
//         insert("e2", "id, name, e1_id", "4, 'd', 2");
//         insert("e2", "id, name, e1_id", "5, 'e', 2");
// 
//         insert("e3", "id, name, e2_id", "6, 'f', 4");
//         insert("e3", "id, name, e2_id", "7, 'g', 4");
//         insert("e3", "id, name, e2_id", "8, 'h', 5");
//     }
// 
//     private void insert(String table, String columns, String values) {
//         String insertSql = "INSERT INTO utest." + table + " (" + columns + ") VALUES (" + values + ")";
//         objectContext.performGenericQuery(new SQLTemplate(table, insertSql));
//     }
// 
//     private void removeDerbyDirectory() {
// 
//         File derbyDir = new File("target/derby");
//         if (derbyDir.isDirectory()) {
//             try {
//                 FileUtils.deleteDirectory(derbyDir);
//             } catch (IOException e) {
//                 throw new RuntimeException(e);
//             }
//         }
//     }
// 
//     private void stopDerby() {
//         try {
//             DriverManager.getConnection("jdbc:derby:;shutdown=true");
//         } catch (SQLException ignored) {
//         }
//     }
// 
//     public ObjectContext getObjectContext() {
//         return objectContext;
//     }
// 
//     public ServerRuntime getServerRuntime() {
//         return serverRuntime;
//     }
// }


// Path: graphql-cayenne/src/test/java/org/objectstyle/graphql/cayenne/it/GraphQLTestFactory.java
import com.fasterxml.jackson.databind.ObjectMapper;
import graphql.GraphQL;
import org.junit.AfterClass;
import org.objectstyle.graphql.cayenne.orm.DefaultSchemaTranslator;
import org.objectstyle.graphql.cayenne.orm.SchemaTranslator;
import org.objectstyle.graphql.test.TestFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.HashMap;

package org.objectstyle.graphql.cayenne.it;



class GraphQLTestFactory {
    private static GraphQL graphQL;
    private static TestFactory testFactory = new TestFactory();
    private static final Logger LOGGER = LoggerFactory.getLogger(GraphQLTestFactory.class);

    GraphQLTestFactory() {
        graphQL = createGraphQL(createSchemaTranslator());
    }

    @AfterClass
    public static void tearDownClass() {
        testFactory.stopServerRuntime();
    }

    private static GraphQL createGraphQL(SchemaTranslator translator) {