// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/GraphQLModule.java
// public class GraphQLModule extends ConfigModule {
// 
// 	@Override
// 	public void configure(Binder binder) {
// 
// 		binder.bind(JacksonReaderWriter.class).in(Singleton.class);
// 		binder.bind(JsonReader.class).to(JacksonReaderWriter.class);
// 		binder.bind(JsonWriter.class).to(JacksonReaderWriter.class);
// 
// 		JerseyBinder.contributeTo(binder).features(GraphQLFeature.class);
// 	}
// 
// 	@Provides
// 	@Singleton
// 	GraphQL createGraphQL(ServerRuntime cayenneRuntime, SchemaTranslator translator) {
// 		GraphQLSchema schema = translator.toGraphQL(cayenneRuntime.getChannel().getEntityResolver());
// 		return new GraphQL(schema);
// 	}
// 
// 	/**
// 	 * Overrides JerseyModule JerseyServlet definition with the one mapped to
// 	 * "/graphql" path.
// 	 * 
// 	 * @param configFactory
// 	 *            Bootique configuration factory.
// 	 * @param config
// 	 *            Jersey config object.
// 	 * @return Jersey servlet as {@link MappedServlet}.
// 	 */
// 	@JerseyServlet
// 	@Provides
// 	@Singleton
// 	MappedServlet createJerseyServlet(ConfigurationFactory configFactory, ResourceConfig config) {
// 		return configFactory.config(JerseyServletFactory.class, configPrefix).initServletPathIfNotSet("/graphql/*")
// 				.createJerseyServlet(config);
// 	}
// 
// 	@Provides
// 	@Singleton
// 	SchemaTranslator createSchemaTranslator(ServerRuntime cayenneRuntime) {
// 		return new DefaultSchemaTranslator(cayenneRuntime.newContext());
// 	}
// 
// }
// 
// Path: bootique-graphql/src/test/java/org/objectstyle/graphql/it/fixture/cayenne/E1.java
// public class E1 extends _E1 {
// 
//     private static final long serialVersionUID = 1L; 
// 
// }


import static org.mockito.Mockito.mock;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Arrays;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.cayenne.ObjectContext;
import org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy;
import org.apache.cayenne.access.dbsync.SchemaUpdateStrategy;
import org.apache.cayenne.configuration.server.ServerRuntime;
import org.apache.cayenne.configuration.server.ServerRuntimeBuilder;
import org.apache.cayenne.query.EJBQLQuery;
import org.apache.cayenne.query.QueryChain;
import org.apache.cayenne.query.RefreshQuery;
import org.apache.cayenne.query.SQLSelect;
import org.apache.cayenne.query.SQLTemplate;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory;
import org.glassfish.jersey.test.spi.TestContainerException;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.objectstyle.bootique.graphql.GraphQLModule;
import org.objectstyle.graphql.it.fixture.cayenne.E1;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.util.Modules;
import com.nhl.bootique.config.ConfigurationFactory;
import com.nhl.bootique.jersey.JerseyModule;
		};

		Module combined = Modules.override(new JerseyModule()).with(new GraphQLModule());
		return Arrays.asList(m, combined);
	}

	@Before
	public void before() {
		this.context = runtime.newContext();

		// this is to prevent shared caches from returning bogus data between
		// test runs
		context.performQuery(new RefreshQuery());

		QueryChain chain = new QueryChain();

		// ordering is important to avoid FK constraint failures on delete

		chain.addQuery(new EJBQLQuery("delete from E2"));
		chain.addQuery(new EJBQLQuery("delete from E1"));

		context.performGenericQuery(chain);
	}

	protected int intForQuery(String querySql) {
		return SQLSelect.scalarQuery(Integer.class, querySql).selectOne(context).intValue();
	}

	protected void insert(String table, String columns, String values) {
		String insertSql = "INSERT INTO utest." + table + " (" + columns + ") VALUES (" + values + ")";
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/GraphQLModule.java
// public class GraphQLModule extends ConfigModule {
// 
// 	@Override
// 	public void configure(Binder binder) {
// 
// 		binder.bind(JacksonReaderWriter.class).in(Singleton.class);
// 		binder.bind(JsonReader.class).to(JacksonReaderWriter.class);
// 		binder.bind(JsonWriter.class).to(JacksonReaderWriter.class);
// 
// 		JerseyBinder.contributeTo(binder).features(GraphQLFeature.class);
// 	}
// 
// 	@Provides
// 	@Singleton
// 	GraphQL createGraphQL(ServerRuntime cayenneRuntime, SchemaTranslator translator) {
// 		GraphQLSchema schema = translator.toGraphQL(cayenneRuntime.getChannel().getEntityResolver());
// 		return new GraphQL(schema);
// 	}
// 
// 	/**
// 	 * Overrides JerseyModule JerseyServlet definition with the one mapped to
// 	 * "/graphql" path.
// 	 * 
// 	 * @param configFactory
// 	 *            Bootique configuration factory.
// 	 * @param config
// 	 *            Jersey config object.
// 	 * @return Jersey servlet as {@link MappedServlet}.
// 	 */
// 	@JerseyServlet
// 	@Provides
// 	@Singleton
// 	MappedServlet createJerseyServlet(ConfigurationFactory configFactory, ResourceConfig config) {
// 		return configFactory.config(JerseyServletFactory.class, configPrefix).initServletPathIfNotSet("/graphql/*")
// 				.createJerseyServlet(config);
// 	}
// 
// 	@Provides
// 	@Singleton
// 	SchemaTranslator createSchemaTranslator(ServerRuntime cayenneRuntime) {
// 		return new DefaultSchemaTranslator(cayenneRuntime.newContext());
// 	}
// 
// }
// 
// Path: bootique-graphql/src/test/java/org/objectstyle/graphql/it/fixture/cayenne/E1.java
// public class E1 extends _E1 {
// 
//     private static final long serialVersionUID = 1L; 
// 
// }


// Path: bootique-graphql/src/test/java/org/objectstyle/bootique/graphql/it/fixture/GraphQLJerseyTestOnDerby.java
import static org.mockito.Mockito.mock;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Arrays;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.cayenne.ObjectContext;
import org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy;
import org.apache.cayenne.access.dbsync.SchemaUpdateStrategy;
import org.apache.cayenne.configuration.server.ServerRuntime;
import org.apache.cayenne.configuration.server.ServerRuntimeBuilder;
import org.apache.cayenne.query.EJBQLQuery;
import org.apache.cayenne.query.QueryChain;
import org.apache.cayenne.query.RefreshQuery;
import org.apache.cayenne.query.SQLSelect;
import org.apache.cayenne.query.SQLTemplate;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory;
import org.glassfish.jersey.test.spi.TestContainerException;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.objectstyle.bootique.graphql.GraphQLModule;
import org.objectstyle.graphql.it.fixture.cayenne.E1;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.util.Modules;
import com.nhl.bootique.config.ConfigurationFactory;
import com.nhl.bootique.jersey.JerseyModule;

		};

		Module combined = Modules.override(new JerseyModule()).with(new GraphQLModule());
		return Arrays.asList(m, combined);
	}

	@Before
	public void before() {
		this.context = runtime.newContext();

		// this is to prevent shared caches from returning bogus data between
		// test runs
		context.performQuery(new RefreshQuery());

		QueryChain chain = new QueryChain();

		// ordering is important to avoid FK constraint failures on delete

		chain.addQuery(new EJBQLQuery("delete from E2"));
		chain.addQuery(new EJBQLQuery("delete from E1"));

		context.performGenericQuery(chain);
	}

	protected int intForQuery(String querySql) {
		return SQLSelect.scalarQuery(Integer.class, querySql).selectOne(context).intValue();
	}

	protected void insert(String table, String columns, String values) {
		String insertSql = "INSERT INTO utest." + table + " (" + columns + ") VALUES (" + values + ")";
		context.performGenericQuery(new SQLTemplate(E1.class, insertSql));