use of org.hibernate.testing.boot.MetadataBuildingContextTestingImpl in project hibernate-orm by hibernate.
the class SequenceHiLoGeneratorNoIncrementTest method setUp.
@Before
public void setUp() throws Exception {
serviceRegistry = new StandardServiceRegistryBuilder().enableAutoClose().applySetting(AvailableSettings.HBM2DDL_AUTO, "create-drop").build();
generator = new SequenceStyleGenerator();
// Build the properties used to configure the id generator
Properties properties = new Properties();
properties.setProperty(SequenceStyleGenerator.SEQUENCE_PARAM, TEST_SEQUENCE);
properties.setProperty(SequenceStyleGenerator.OPT_PARAM, "legacy-hilo");
// JPA allocationSize of 1
properties.setProperty(SequenceStyleGenerator.INCREMENT_PARAM, "0");
properties.put(PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER, new ObjectNameNormalizer() {
@Override
protected MetadataBuildingContext getBuildingContext() {
return new MetadataBuildingContextTestingImpl(serviceRegistry);
}
});
generator.configure(StandardBasicTypes.LONG, properties, serviceRegistry);
final Metadata metadata = new MetadataSources(serviceRegistry).buildMetadata();
generator.registerExportables(metadata.getDatabase());
sessionFactory = (SessionFactoryImplementor) metadata.buildSessionFactory();
sequenceValueExtractor = new SequenceValueExtractor(sessionFactory.getDialect(), TEST_SEQUENCE);
}
use of org.hibernate.testing.boot.MetadataBuildingContextTestingImpl in project hibernate-orm by hibernate.
the class SequenceHiLoGeneratorTest method setUp.
@Before
public void setUp() throws Exception {
serviceRegistry = new StandardServiceRegistryBuilder().enableAutoClose().applySetting(AvailableSettings.HBM2DDL_AUTO, "create-drop").build();
MetadataBuildingContext buildingContext = new MetadataBuildingContextTestingImpl(serviceRegistry);
Properties properties = new Properties();
properties.setProperty(SequenceGenerator.SEQUENCE, TEST_SEQUENCE);
properties.setProperty(SequenceHiLoGenerator.MAX_LO, "3");
properties.put(PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER, buildingContext.getObjectNameNormalizer());
generator = new SequenceHiLoGenerator();
generator.configure(StandardBasicTypes.LONG, properties, serviceRegistry);
Metadata metadata = new MetadataSources(serviceRegistry).buildMetadata();
generator.registerExportables(metadata.getDatabase());
sessionFactory = (SessionFactoryImplementor) metadata.buildSessionFactory();
sequenceValueExtractor = new SequenceValueExtractor(sessionFactory.getDialect(), TEST_SEQUENCE);
}
use of org.hibernate.testing.boot.MetadataBuildingContextTestingImpl in project hibernate-orm by hibernate.
the class SequenceStyleConfigUnitTest method buildGeneratorPropertiesBase.
private Properties buildGeneratorPropertiesBase(StandardServiceRegistry serviceRegistry) {
Properties props = new Properties();
props.put(PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER, new MetadataBuildingContextTestingImpl(serviceRegistry).getObjectNameNormalizer());
return props;
}
use of org.hibernate.testing.boot.MetadataBuildingContextTestingImpl in project hibernate-orm by hibernate.
the class PersistentClassVisitorTest method prepare.
@Before
public void prepare() {
serviceRegistry = new StandardServiceRegistryBuilder().build();
metadataBuildingContext = new MetadataBuildingContextTestingImpl(serviceRegistry);
}
use of org.hibernate.testing.boot.MetadataBuildingContextTestingImpl in project hibernate-orm by hibernate.
the class ValueVisitorTest method prepare.
@Before
public void prepare() {
serviceRegistry = new StandardServiceRegistryBuilder().build();
metadataBuildingContext = new MetadataBuildingContextTestingImpl(serviceRegistry);
}
Aggregations