use of org.hibernate.testing.boot.MetadataBuildingContextTestingImpl in project hibernate-orm by hibernate.
the class AttributeConverterTest method testBasicOperation.
@Test
public void testBasicOperation() {
SimpleValue simpleValue = new SimpleValue(new MetadataBuildingContextTestingImpl());
simpleValue.setJpaAttributeConverterDescriptor(new InstanceBasedConverterDescriptor(new StringClobConverter(), new ClassmateContext()));
simpleValue.setTypeUsingReflection(IrrelevantEntity.class.getName(), "name");
Type type = simpleValue.getType();
assertNotNull(type);
if (!AttributeConverterTypeAdapter.class.isInstance(type)) {
fail("AttributeConverter not applied");
}
AbstractStandardBasicType basicType = assertTyping(AbstractStandardBasicType.class, type);
assertSame(StringTypeDescriptor.INSTANCE, basicType.getJavaTypeDescriptor());
assertEquals(Types.CLOB, basicType.getSqlTypeDescriptor().getSqlType());
}
use of org.hibernate.testing.boot.MetadataBuildingContextTestingImpl in project hibernate-orm by hibernate.
the class ValueVisitorTest method testProperCallbacks.
@Test
public void testProperCallbacks() {
final MetadataImplementor metadata = (MetadataImplementor) new MetadataSources(serviceRegistry).buildMetadata();
final Table tbl = new Table();
final RootClass rootClass = new RootClass(metadataBuildingContext);
ValueVisitor vv = new ValueVisitorValidator();
MetadataBuildingContextTestingImpl metadataBuildingContext = new MetadataBuildingContextTestingImpl();
new Any(metadataBuildingContext, tbl).accept(vv);
new Array(metadataBuildingContext, rootClass).accept(vv);
new Bag(metadataBuildingContext, rootClass).accept(vv);
new Component(metadataBuildingContext, rootClass).accept(vv);
new DependantValue(metadataBuildingContext, tbl, null).accept(vv);
new IdentifierBag(metadataBuildingContext, rootClass).accept(vv);
new List(metadataBuildingContext, rootClass).accept(vv);
new ManyToOne(metadataBuildingContext, tbl).accept(vv);
new Map(metadataBuildingContext, rootClass).accept(vv);
new OneToMany(metadataBuildingContext, rootClass).accept(vv);
new OneToOne(metadataBuildingContext, tbl, rootClass).accept(vv);
new PrimitiveArray(metadataBuildingContext, rootClass).accept(vv);
new Set(metadataBuildingContext, rootClass).accept(vv);
new SimpleValue(metadataBuildingContext).accept(vv);
}
use of org.hibernate.testing.boot.MetadataBuildingContextTestingImpl in project hibernate-orm by hibernate.
the class PersistentClassTest method prepare.
@Before
public void prepare() {
serviceRegistry = new StandardServiceRegistryBuilder().build();
metadataBuildingContext = new MetadataBuildingContextTestingImpl(serviceRegistry);
}
Aggregations