eu.drus.jpa.unit.neo4j.ext.ConfigurationRegistry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jpa-unit-neo4j Show documentation
Show all versions of jpa-unit-neo4j Show documentation
JUnit extension for simple testing of JPA entities and components
The newest version!
package eu.drus.jpa.unit.neo4j.ext;
import java.util.ServiceLoader;
import eu.drus.jpa.unit.api.JpaUnitException;
import eu.drus.jpa.unit.spi.PersistenceUnitDescriptor;
public class ConfigurationRegistry {
private static final ServiceLoader CONFIG_FACTORIES = ServiceLoader.load(ConfigurationFactory.class);
public boolean hasConfiguration(final PersistenceUnitDescriptor descriptor) {
for (final ConfigurationFactory factory : CONFIG_FACTORIES) {
if (factory.isSupported(descriptor)) {
return true;
}
}
return false;
}
public Configuration getConfiguration(final PersistenceUnitDescriptor descriptor) {
for (final ConfigurationFactory factory : CONFIG_FACTORIES) {
if (factory.isSupported(descriptor)) {
return factory.createConfiguration(descriptor);
}
}
throw new JpaUnitException("Unsupported JPA provider");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy