// Path: repository/hibernate/src/main/java/org/artificer/repository/hibernate/entity/ArtificerProperty.java
// @Entity
// @Indexed
// @Analyzer(impl = StandardAnalyzer.class)
// @Table(name = "Property")
// public class ArtificerProperty implements Serializable {
// 
//     private long id;
// 
//     private String key;
// 
//     private String value;
// 
//     private boolean isCustom;
// 
//     private ArtificerArtifact owner;
// 
//     @Id
//     @GeneratedValue
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     @Column(name = "propertyKey")
//     @Field
//     public String getKey() {
//         return key;
//     }
// 
//     public void setKey(String key) {
//         this.key = key;
//     }
// 
//     @Column(name = "propertyValue")
//     @Field
//     public String getValue() {
//         return value;
//     }
// 
//     public void setValue(String value) {
//         this.value = value;
//     }
// 
//     public boolean isCustom() {
//         return isCustom;
//     }
// 
//     public void setCustom(boolean isCustom) {
//         this.isCustom = isCustom;
//     }
// 
//     @ContainedIn
//     @ManyToOne(optional = false)
//     public ArtificerArtifact getOwner() {
//         return owner;
//     }
// 
//     public void setOwner(ArtificerArtifact owner) {
//         this.owner = owner;
//     }
// }
// 
// Path: repository/test/src/test/java/org/artificer/repository/test/RepositoryTestProvider.java
// public interface RepositoryTestProvider {
// 
//     public void before() throws Exception;
// 
//     public void after() throws Exception;
// }


import org.artificer.repository.filter.ServletCredentialsFilter;
import org.artificer.repository.hibernate.HibernateUtil;
import org.artificer.repository.hibernate.entity.ArtificerArtifact;
import org.artificer.repository.hibernate.entity.ArtificerProperty;
import org.artificer.repository.hibernate.file.FileManagerFactory;
import org.artificer.repository.test.RepositoryTestProvider;
import org.hibernate.Session;
import org.hibernate.search.jpa.FullTextEntityManager;
import javax.persistence.EntityManager;
import java.util.List;
import java.util.Map;
        }

        FileManagerFactory.reset();

        ServletCredentialsFilter.setUsername("junituser");
    }

    @Override
    public void after() throws Exception {
		new HibernateUtil.HibernateTask<Void>() {
			@Override
			protected Void doExecute(EntityManager entityManager) throws Exception {
				// H2 specific
				entityManager.createNativeQuery("SET REFERENTIAL_INTEGRITY FALSE").executeUpdate();
				entityManager.createNativeQuery("SET LOCK_MODE 0").executeUpdate();
				List<Object[]> tables = entityManager.createNativeQuery("SHOW TABLES").getResultList();
				for (Object[] table : tables) {
					entityManager.createNativeQuery("TRUNCATE TABLE " + table[0]).executeUpdate();
				}
				entityManager.createNativeQuery("SET REFERENTIAL_INTEGRITY true").executeUpdate();
				entityManager.createNativeQuery("SET LOCK_MODE 3").executeUpdate();

				// purge caches
				entityManager.unwrap(Session.class).getSessionFactory().getCache().evictCollectionRegions();
				entityManager.unwrap(Session.class).getSessionFactory().getCache().evictEntityRegions();
				entityManager.unwrap(Session.class).getSessionFactory().getCache().evictQueryRegions();

				// purge Hibernate Search
				FullTextEntityManager fullTextEntityManager
						= org.hibernate.search.jpa.Search.getFullTextEntityManager(entityManager);
// Path: repository/hibernate/src/main/java/org/artificer/repository/hibernate/entity/ArtificerProperty.java
// @Entity
// @Indexed
// @Analyzer(impl = StandardAnalyzer.class)
// @Table(name = "Property")
// public class ArtificerProperty implements Serializable {
// 
//     private long id;
// 
//     private String key;
// 
//     private String value;
// 
//     private boolean isCustom;
// 
//     private ArtificerArtifact owner;
// 
//     @Id
//     @GeneratedValue
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     @Column(name = "propertyKey")
//     @Field
//     public String getKey() {
//         return key;
//     }
// 
//     public void setKey(String key) {
//         this.key = key;
//     }
// 
//     @Column(name = "propertyValue")
//     @Field
//     public String getValue() {
//         return value;
//     }
// 
//     public void setValue(String value) {
//         this.value = value;
//     }
// 
//     public boolean isCustom() {
//         return isCustom;
//     }
// 
//     public void setCustom(boolean isCustom) {
//         this.isCustom = isCustom;
//     }
// 
//     @ContainedIn
//     @ManyToOne(optional = false)
//     public ArtificerArtifact getOwner() {
//         return owner;
//     }
// 
//     public void setOwner(ArtificerArtifact owner) {
//         this.owner = owner;
//     }
// }
// 
// Path: repository/test/src/test/java/org/artificer/repository/test/RepositoryTestProvider.java
// public interface RepositoryTestProvider {
// 
//     public void before() throws Exception;
// 
//     public void after() throws Exception;
// }


// Path: repository/test/src/test/java/org/artificer/repository/test/hibernate/HibernateRepositoryTestProvider.java
import org.artificer.repository.filter.ServletCredentialsFilter;
import org.artificer.repository.hibernate.HibernateUtil;
import org.artificer.repository.hibernate.entity.ArtificerArtifact;
import org.artificer.repository.hibernate.entity.ArtificerProperty;
import org.artificer.repository.hibernate.file.FileManagerFactory;
import org.artificer.repository.test.RepositoryTestProvider;
import org.hibernate.Session;
import org.hibernate.search.jpa.FullTextEntityManager;
import javax.persistence.EntityManager;
import java.util.List;
import java.util.Map;

        }

        FileManagerFactory.reset();

        ServletCredentialsFilter.setUsername("junituser");
    }

    @Override
    public void after() throws Exception {
		new HibernateUtil.HibernateTask<Void>() {
			@Override
			protected Void doExecute(EntityManager entityManager) throws Exception {
				// H2 specific
				entityManager.createNativeQuery("SET REFERENTIAL_INTEGRITY FALSE").executeUpdate();
				entityManager.createNativeQuery("SET LOCK_MODE 0").executeUpdate();
				List<Object[]> tables = entityManager.createNativeQuery("SHOW TABLES").getResultList();
				for (Object[] table : tables) {
					entityManager.createNativeQuery("TRUNCATE TABLE " + table[0]).executeUpdate();
				}
				entityManager.createNativeQuery("SET REFERENTIAL_INTEGRITY true").executeUpdate();
				entityManager.createNativeQuery("SET LOCK_MODE 3").executeUpdate();

				// purge caches
				entityManager.unwrap(Session.class).getSessionFactory().getCache().evictCollectionRegions();
				entityManager.unwrap(Session.class).getSessionFactory().getCache().evictEntityRegions();
				entityManager.unwrap(Session.class).getSessionFactory().getCache().evictQueryRegions();

				// purge Hibernate Search
				FullTextEntityManager fullTextEntityManager
						= org.hibernate.search.jpa.Search.getFullTextEntityManager(entityManager);
				fullTextEntityManager.purgeAll(ArtificerProperty.class);