HHH-16625 Introduce a compilation unit among tests to serve as reminder about Quarkus requirements

This commit is contained in:
Sanne Grinovero 2023-05-17 20:37:04 +01:00 committed by Andrea Boriero
parent a8ce9f615c
commit 67488980e0
2 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,53 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.orm.test.quarkus;
import org.hibernate.boot.internal.MetadataImpl;
import org.junit.Test;
/**
* Quarkus needs to be able to make a deep copy of MetadataImpl;
* for this to be possible, it needs to expose some of its state.
* Adding a test to help remembering about this requirement: we
* only need this to compile so that it serves as a reminder.
*/
public class MetadataCopyingTest {
public void copyIsPossible() {
MetadataImpl existingInstance = fetchSomehowOldCopy();
//Test that for each constructor parameter needed to create a new MetadataImpl,
//we can actually read the matching state from an existing MetadataImpl instance.
MetadataImpl newcopy = new MetadataImpl(
existingInstance.getUUID(),
existingInstance.getMetadataBuildingOptions(),
existingInstance.getEntityBindingMap(),
existingInstance.getComposites(),
existingInstance.getGenericComponentsMap(),
existingInstance.getMappedSuperclassMap(),
existingInstance.getCollectionBindingMap(),
existingInstance.getTypeDefinitionMap(),
existingInstance.getFilterDefinitions(),
existingInstance.getFetchProfileMap(),
existingInstance.getImports(),
existingInstance.getIdGeneratorDefinitionMap(),
existingInstance.getNamedQueryMap(),
existingInstance.getNamedNativeQueryMap(),
existingInstance.getNamedProcedureCallMap(),
existingInstance.getSqlResultSetMappingMap(),
existingInstance.getNamedEntityGraphs(),
existingInstance.getSqlFunctionMap(),
existingInstance.getDatabase(),
existingInstance.getBootstrapContext()
);
}
private MetadataImpl fetchSomehowOldCopy() {
return null;
}
}

View File

@ -0,0 +1,16 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.orm.test.quarkus;
/**
* Contains hints and reminders useful to smoother compatibility with Quarkus.
* These are intentionally not full integration tests to avoid high coupling
* and circularity of builds, but meant as simple reminders during maintenance
* of Hibernate ORM.
* It's acceptable to occasionally change these, but please ensure there's
* a plan for progress that works for both projects.
*/