// Path: plume-db-querydsl/src/test/java/com/coreoz/plume/db/querydsl/DbQuerydslTestModule.java
// public class DbQuerydslTestModule extends AbstractModule {
// 
// 	@Override
// 	protected void configure() {
// 		install(new GuiceConfModule());
// 		install(new DataSourceModule());
// 		install(new GuiceDbTestModule());
// 	}
// 
// }
// 
// Path: plume-db-querydsl/src/test/java/com/coreoz/plume/db/querydsl/db/QUser.java
// @Generated("com.querydsl.sql.codegen.MetaDataSerializer")
// public class QUser extends com.querydsl.sql.RelationalPathBase<User> {
// 
//     private static final long serialVersionUID = -50309753;
// 
//     public static final QUser user = new QUser("USER");
// 
//     public final BooleanPath active = createBoolean("active");
// 
//     public final DateTimePath<java.time.LocalDateTime> creationDate = createDateTime("creationDate", java.time.LocalDateTime.class);
// 
//     public final NumberPath<Long> id = createNumber("id", Long.class);
// 
//     public final StringPath name = createString("name");
// 
//     public final com.querydsl.sql.PrimaryKey<User> constraint2 = createPrimaryKey(id);
// 
//     public QUser(String variable) {
//         super(User.class, forVariable(variable), "PUBLIC", "USER");
//         addMetadata();
//     }
// 
//     public QUser(String variable, String schema, String table) {
//         super(User.class, forVariable(variable), schema, table);
//         addMetadata();
//     }
// 
//     public QUser(Path<? extends User> path) {
//         super(path.getType(), path.getMetadata(), "PUBLIC", "USER");
//         addMetadata();
//     }
// 
//     public QUser(PathMetadata metadata) {
//         super(User.class, metadata, "PUBLIC", "USER");
//         addMetadata();
//     }
// 
//     public void addMetadata() {
//         addMetadata(active, ColumnMetadata.named("ACTIVE").withIndex(3).ofType(Types.BOOLEAN).withSize(1));
//         addMetadata(creationDate, ColumnMetadata.named("CREATION_DATE").withIndex(4).ofType(Types.TIMESTAMP).withSize(23).withDigits(10));
//         addMetadata(id, ColumnMetadata.named("ID").withIndex(1).ofType(Types.BIGINT).withSize(19).notNull());
//         addMetadata(name, ColumnMetadata.named("NAME").withIndex(2).ofType(Types.VARCHAR).withSize(255));
//     }
// 
// }


import static org.assertj.core.api.Assertions.assertThat;
import java.sql.SQLException;
import javax.inject.Inject;
import javax.sql.DataSource;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.carlosbecker.guice.GuiceModules;
import com.carlosbecker.guice.GuiceTestRunner;
import com.coreoz.plume.db.querydsl.DbQuerydslTestModule;
import com.coreoz.plume.db.querydsl.db.QUser;
package com.coreoz.plume.db.querydsl.transaction;






@RunWith(GuiceTestRunner.class)
@GuiceModules(DbQuerydslTestModule.class)
public class TransactionManagerQuerydslTest {

	@Inject
	DataSource dataSource;

	// exception release checks

	@Test
	public void check_that_connection_is_released_after_exception_during_select_query() throws SQLException {
		TransactionInstancesHolder testInstancesHolder = new TransactionInstancesHolder(dataSource);

		try {
			testInstancesHolder
				.getTransactionManager()
				.selectQuery();

			throw new Exception();
		} catch (Exception e) {
			// as expected
		}

		assertThat(testInstancesHolder.getMockedDataSource().isConnectionAvailable()).isTrue();
	}

	@Test
	public void check_that_connection_is_released_after_exception_during_delete_query() throws SQLException {
		TransactionInstancesHolder testInstancesHolder = new TransactionInstancesHolder(dataSource);

		try {
			testInstancesHolder
				.getTransactionManager()
// Path: plume-db-querydsl/src/test/java/com/coreoz/plume/db/querydsl/DbQuerydslTestModule.java
// public class DbQuerydslTestModule extends AbstractModule {
// 
// 	@Override
// 	protected void configure() {
// 		install(new GuiceConfModule());
// 		install(new DataSourceModule());
// 		install(new GuiceDbTestModule());
// 	}
// 
// }
// 
// Path: plume-db-querydsl/src/test/java/com/coreoz/plume/db/querydsl/db/QUser.java
// @Generated("com.querydsl.sql.codegen.MetaDataSerializer")
// public class QUser extends com.querydsl.sql.RelationalPathBase<User> {
// 
//     private static final long serialVersionUID = -50309753;
// 
//     public static final QUser user = new QUser("USER");
// 
//     public final BooleanPath active = createBoolean("active");
// 
//     public final DateTimePath<java.time.LocalDateTime> creationDate = createDateTime("creationDate", java.time.LocalDateTime.class);
// 
//     public final NumberPath<Long> id = createNumber("id", Long.class);
// 
//     public final StringPath name = createString("name");
// 
//     public final com.querydsl.sql.PrimaryKey<User> constraint2 = createPrimaryKey(id);
// 
//     public QUser(String variable) {
//         super(User.class, forVariable(variable), "PUBLIC", "USER");
//         addMetadata();
//     }
// 
//     public QUser(String variable, String schema, String table) {
//         super(User.class, forVariable(variable), schema, table);
//         addMetadata();
//     }
// 
//     public QUser(Path<? extends User> path) {
//         super(path.getType(), path.getMetadata(), "PUBLIC", "USER");
//         addMetadata();
//     }
// 
//     public QUser(PathMetadata metadata) {
//         super(User.class, metadata, "PUBLIC", "USER");
//         addMetadata();
//     }
// 
//     public void addMetadata() {
//         addMetadata(active, ColumnMetadata.named("ACTIVE").withIndex(3).ofType(Types.BOOLEAN).withSize(1));
//         addMetadata(creationDate, ColumnMetadata.named("CREATION_DATE").withIndex(4).ofType(Types.TIMESTAMP).withSize(23).withDigits(10));
//         addMetadata(id, ColumnMetadata.named("ID").withIndex(1).ofType(Types.BIGINT).withSize(19).notNull());
//         addMetadata(name, ColumnMetadata.named("NAME").withIndex(2).ofType(Types.VARCHAR).withSize(255));
//     }
// 
// }


// Path: plume-db-querydsl/src/test/java/com/coreoz/plume/db/querydsl/transaction/TransactionManagerQuerydslTest.java
import static org.assertj.core.api.Assertions.assertThat;
import java.sql.SQLException;
import javax.inject.Inject;
import javax.sql.DataSource;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.carlosbecker.guice.GuiceModules;
import com.carlosbecker.guice.GuiceTestRunner;
import com.coreoz.plume.db.querydsl.DbQuerydslTestModule;
import com.coreoz.plume.db.querydsl.db.QUser;

package com.coreoz.plume.db.querydsl.transaction;






@RunWith(GuiceTestRunner.class)
@GuiceModules(DbQuerydslTestModule.class)
public class TransactionManagerQuerydslTest {

	@Inject
	DataSource dataSource;

	// exception release checks

	@Test
	public void check_that_connection_is_released_after_exception_during_select_query() throws SQLException {
		TransactionInstancesHolder testInstancesHolder = new TransactionInstancesHolder(dataSource);

		try {
			testInstancesHolder
				.getTransactionManager()
				.selectQuery();

			throw new Exception();
		} catch (Exception e) {
			// as expected
		}

		assertThat(testInstancesHolder.getMockedDataSource().isConnectionAvailable()).isTrue();
	}

	@Test
	public void check_that_connection_is_released_after_exception_during_delete_query() throws SQLException {
		TransactionInstancesHolder testInstancesHolder = new TransactionInstancesHolder(dataSource);

		try {
			testInstancesHolder
				.getTransactionManager()
				.delete(QUser.user);