// Path: raidenjpa-core/src/main/java/org/raidenjpa/spec/RaidenEntityManagerFactory.java
// public class RaidenEntityManagerFactory implements EntityManagerFactory {
// 
// 	@SuppressWarnings("rawtypes")
// 	public EntityManager createEntityManager() {
// 		return createEntityManager(new HashMap());
// 	}
// 
// 	@SuppressWarnings("rawtypes")
// 	public EntityManager createEntityManager(Map map) {
// 		return new RaidenEntityManager();
// 	}
// 
// 	public Metamodel getMetamodel() {
// 		throw new NotYetImplementedException();
// 	}
// 
// 	public boolean isOpen() {
// 		throw new NotYetImplementedException();
// 	}
// 
// 	public void close() {
// 		
// 	}
// 
// 	public Map<String, Object> getProperties() {
// 		throw new NotYetImplementedException();
// 	}
// 
// 	public PersistenceUnitUtil getPersistenceUnitUtil() {
// 		throw new NotYetImplementedException();
// 	}
// 
// 	public Cache getCache() {
// 		throw new NoPlansToImplementException();
// 	}
// 	
// 	public CriteriaBuilder getCriteriaBuilder() {
// 		throw new NoPlansToImplementException();
// 	}
// }


import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.raidenjpa.spec.RaidenEntityManagerFactory;

package org.raidenjpa.util;




@BadSmell("Static blocks the ability of run tests in parallel")
public class EntityManagerUtil {

	private static List<EntityManager> ems = new ArrayList<EntityManager>();

	private static EntityManagerFactory emfHibernate;
	
	private static EntityManagerFactory emfRaiden;

	private static TestType testType;

	public static EntityManager em() {
		EntityManager em = emf().createEntityManager();

		ems.add(em);

		return em;
	}

	private synchronized static EntityManagerFactory emf() {
		if (testType == null) {
			throw new RuntimeException("testType not defined");
		}
		
		if (testType == TestType.HIBERNATE) {
			if (emfHibernate == null) {
				emfHibernate = Persistence.createEntityManagerFactory("test-pu");
			}
			return emfHibernate;
		} else if (testType == TestType.RAIDEN) {
			if (emfRaiden == null) {

// Path: raidenjpa-core/src/main/java/org/raidenjpa/spec/RaidenEntityManagerFactory.java
// public class RaidenEntityManagerFactory implements EntityManagerFactory {
// 
// 	@SuppressWarnings("rawtypes")
// 	public EntityManager createEntityManager() {
// 		return createEntityManager(new HashMap());
// 	}
// 
// 	@SuppressWarnings("rawtypes")
// 	public EntityManager createEntityManager(Map map) {
// 		return new RaidenEntityManager();
// 	}
// 
// 	public Metamodel getMetamodel() {
// 		throw new NotYetImplementedException();
// 	}
// 
// 	public boolean isOpen() {
// 		throw new NotYetImplementedException();
// 	}
// 
// 	public void close() {
// 		
// 	}
// 
// 	public Map<String, Object> getProperties() {
// 		throw new NotYetImplementedException();
// 	}
// 
// 	public PersistenceUnitUtil getPersistenceUnitUtil() {
// 		throw new NotYetImplementedException();
// 	}
// 
// 	public Cache getCache() {
// 		throw new NoPlansToImplementException();
// 	}
// 	
// 	public CriteriaBuilder getCriteriaBuilder() {
// 		throw new NoPlansToImplementException();
// 	}
// }


// Path: raidenjpa-core/src/test/java/org/raidenjpa/util/EntityManagerUtil.java
import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.raidenjpa.spec.RaidenEntityManagerFactory;

package org.raidenjpa.util;




@BadSmell("Static blocks the ability of run tests in parallel")
public class EntityManagerUtil {

	private static List<EntityManager> ems = new ArrayList<EntityManager>();

	private static EntityManagerFactory emfHibernate;
	
	private static EntityManagerFactory emfRaiden;

	private static TestType testType;

	public static EntityManager em() {
		EntityManager em = emf().createEntityManager();

		ems.add(em);

		return em;
	}

	private synchronized static EntityManagerFactory emf() {
		if (testType == null) {
			throw new RuntimeException("testType not defined");
		}
		
		if (testType == TestType.HIBERNATE) {
			if (emfHibernate == null) {
				emfHibernate = Persistence.createEntityManagerFactory("test-pu");
			}
			return emfHibernate;
		} else if (testType == TestType.RAIDEN) {
			if (emfRaiden == null) {

				emfRaiden = new RaidenEntityManagerFactory();
