mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-25 07:04:43 +00:00
parent
71a2b0145c
commit
7a6e9a8060
@ -332,7 +332,7 @@ public abstract class EntityRepository<T> {
|
||||
return JsonUtils.readValue(json, entityClass);
|
||||
}
|
||||
// If requested the latest version, return it from current version of the entity
|
||||
T entity = setFields(dao.findEntityById(UUID.fromString(id)), putFields);
|
||||
T entity = setFields(dao.findEntityById(UUID.fromString(id), Include.ALL), putFields);
|
||||
EntityInterface<T> entityInterface = getEntityInterface(entity);
|
||||
if (entityInterface.getVersion().equals(requestedVersion)) {
|
||||
return entity;
|
||||
@ -343,7 +343,7 @@ public abstract class EntityRepository<T> {
|
||||
|
||||
@Transaction
|
||||
public EntityHistory listVersions(String id) throws IOException, ParseException {
|
||||
T latest = setFields(dao.findEntityById(UUID.fromString(id)), putFields);
|
||||
T latest = setFields(dao.findEntityById(UUID.fromString(id), Include.ALL), putFields);
|
||||
String extensionPrefix = EntityUtil.getVersionExtensionPrefix(entityType);
|
||||
List<EntityVersionPair> oldVersions = daoCollection.entityExtensionDAO().getEntityVersions(id, extensionPrefix);
|
||||
oldVersions.sort(EntityUtil.compareVersion.reversed());
|
||||
|
||||
@ -537,6 +537,19 @@ public abstract class EntityResourceTest<T> extends CatalogApplicationTest {
|
||||
validateGetWithDifferentFields(entity, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void get_deletedVersion(TestInfo test) throws IOException, URISyntaxException {
|
||||
Object create = createRequest(getEntityName(test), "description", "displayName", USER_OWNER1);
|
||||
T entity = createEntity(create, adminAuthHeaders());
|
||||
EntityInterface<T> entityInterface = getEntityInterface(entity);
|
||||
getEntity(entityInterface.getId(), null, allFields, adminAuthHeaders());
|
||||
deleteAndCheckEntity(entity, adminAuthHeaders());
|
||||
EntityHistory history = getVersionList(entityInterface.getId(), adminAuthHeaders());
|
||||
T latestVersion = JsonUtils.readValue((String) history.getVersions().get(0), entityClass);
|
||||
entityInterface = getEntityInterface(latestVersion);
|
||||
getVersion(entityInterface.getId(), entityInterface.getVersion(), adminAuthHeaders());
|
||||
}
|
||||
|
||||
@Test
|
||||
void get_entityIncludeDeleted_200(TestInfo test) throws IOException, URISyntaxException {
|
||||
Object create = createRequest(getEntityName(test), "description", "displayName", USER_OWNER1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user