Fixed code to comply with uuid property rename to id

This commit is contained in:
Luca Frosini 2023-04-28 11:45:23 +02:00
parent b04623028e
commit 34a2dd7959
3 changed files with 14 additions and 14 deletions

View File

@ -253,7 +253,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
context = getContextFromServer(ContextPath.CURRENT_CONTEXT_PATH_PART);
contextCache.cleanCache();
contextCache.refreshContextsIfNeeded();
Context c = contextCache.getContextByUUID(context.getUUID());
Context c = contextCache.getContextByUUID(context.getID());
if(c!=null){
context = c;
}else {
@ -272,7 +272,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
context = getContextFromServer(ContextPath.CURRENT_CONTEXT_PATH_PART);
contextCache.cleanCache();
contextCache.refreshContextsIfNeeded();
Context c = contextCache.getContextByUUID(context.getUUID());
Context c = contextCache.getContextByUUID(context.getID());
if(c!=null){
context = c;
}else {
@ -584,7 +584,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
public <R extends Resource, C extends ConsistsOf<?,?>, F extends Facet> List<R> getResourcesFromReferenceFacet(
Class<R> resourceClass, Class<C> consistsOfClass, F referenceFacet,
boolean polymorphic) throws ResourceRegistryException {
UUID referenceFacetUUID = referenceFacet.getUUID();
UUID referenceFacetUUID = referenceFacet.getID();
@SuppressWarnings("unchecked")
Class<F> facetClass = (Class<F>) referenceFacet.getClass();
return getResourcesFromReferenceFacet(resourceClass, consistsOfClass, facetClass, referenceFacetUUID,
@ -639,7 +639,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
public <R extends Resource, I extends IsRelatedTo<?,?>, RR extends Resource> List<R> getRelatedResourcesFromReferenceResource(
Class<R> resourceClass, Class<I> isRelatedToClass, RR referenceResource,
Direction direction, boolean polymorphic) throws ResourceRegistryException {
UUID referenceResourceUUID = referenceResource.getUUID();
UUID referenceResourceUUID = referenceResource.getID();
@SuppressWarnings("unchecked")
Class<RR> referenceResourceClass = (Class<RR>) referenceResource.getClass();
return getRelatedResourcesFromReferenceResource(resourceClass, isRelatedToClass, referenceResourceClass,
@ -719,7 +719,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
protected <E extends Entity, R extends Relation<?,?>, RE extends Entity> List<E> getRelated(Class<E> entityClass,
Class<R> relationClass, Class<RE> referenceEntityClass, RE referenceEntity, Direction direction,
boolean polymorphic) throws ResourceRegistryException {
UUID referenceEntityUUID = referenceEntity.getUUID();
UUID referenceEntityUUID = referenceEntity.getID();
return getRelated(entityClass, relationClass, referenceEntityClass, referenceEntityUUID, direction,
polymorphic);
}

View File

@ -133,7 +133,7 @@ public class ResourceRegistryClientTest extends ContextTest {
public void testGetRelatedResourcesFromReferenceResourceByClasses() throws Exception {
UUID uuid = UUIDUtility.fromString("b0d15e45-62af-4221-b785-7d014f10e631");
HostingNode hostingNode = new HostingNodeImpl();
hostingNode.setUUID(uuid);
hostingNode.setID(uuid);
Metadata metadata = new MetadataImpl();
hostingNode.setMetadata(metadata);
List<EService> eServices = resourceRegistryClient.getRelatedResourcesFromReferenceResource(EService.class,
@ -157,7 +157,7 @@ public class ResourceRegistryClientTest extends ContextTest {
// @Test
public void testGetResourcesFromReferenceFacet() throws ResourceRegistryException, JsonProcessingException {
SoftwareFacet softwareFacet = new SoftwareFacetImpl();
softwareFacet.setUUID(UUIDManager.getInstance().generateValidUUID());
softwareFacet.setID(UUIDManager.getInstance().generateValidUUID());
Metadata metadata = new MetadataImpl();
softwareFacet.setMetadata(metadata);
List<EService> eServices = resourceRegistryClient.getResourcesFromReferenceFacet(EService.class, IsIdentifiedBy.class, softwareFacet, true);
@ -177,11 +177,11 @@ public class ResourceRegistryClientTest extends ContextTest {
for(Context c : contexts) {
UUID uuid = c.getUUID();
UUID uuid = c.getID();
if(c.getParent()!=null) {
IsParentOf isParentOf = c.getParent();
Context parentContext = isParentOf.getSource();
UUID parentUUID = parentContext.getUUID();
UUID parentUUID = parentContext.getID();
Assert.assertEquals(parentContext, contextCache.getContextByUUID(parentUUID));
List<IsParentOf> children = parentContext.getChildren();
boolean found = false;
@ -192,9 +192,9 @@ public class ResourceRegistryClientTest extends ContextTest {
}
}
Assert.assertTrue(found);
logger.debug("{} : {} (parent {} : {})", c.getUUID(), contextCache.getContextFullNameByUUID(uuid), parentUUID, contextCache.getContextFullNameByUUID(parentUUID));
logger.debug("{} : {} (parent {} : {})", c.getID(), contextCache.getContextFullNameByUUID(uuid), parentUUID, contextCache.getContextFullNameByUUID(parentUUID));
}else {
logger.debug("{} : {}", c.getUUID(), contextCache.getContextFullNameByUUID(uuid));
logger.debug("{} : {}", c.getID(), contextCache.getContextFullNameByUUID(uuid));
}
}
@ -202,7 +202,7 @@ public class ResourceRegistryClientTest extends ContextTest {
logger.debug("Current context : {}", currentContext);
for(Context c : contexts) {
UUID uuid = c.getUUID();
UUID uuid = c.getID();
Context context = resourceRegistryClient.getContext(uuid);
String fullName = ContextCache.getInstance().getContextFullNameByUUID(uuid);
logger.debug("{} - {} : {}", uuid, fullName, context);

View File

@ -74,7 +74,7 @@ public class ResourceRegistryClientTestWikiExamples extends ContextTest {
public void testExample2Alt() throws ResourceRegistryException, Exception{
SoftwareFacet softwareFacetInstance = new SoftwareFacetImpl();
UUID uuid = UUIDUtility.fromString("97984812-90e6-4eb7-b804-50a9ad3fe4fb");
softwareFacetInstance.setUUID(uuid);
softwareFacetInstance.setID(uuid);
List<EService> list = resourceRegistryClient.getResourcesFromReferenceFacet(EService.class, IsIdentifiedBy.class, softwareFacetInstance, true);
logger.debug("{}", list);
}
@ -180,7 +180,7 @@ public class ResourceRegistryClientTestWikiExamples extends ContextTest {
public void testExample8Alt() throws Exception{
HostingNode hostingNodeInstance = new HostingNodeImpl();
UUID uuid = UUIDUtility.fromString("16032d09-3823-444e-a1ff-a67de4f350a");
hostingNodeInstance.setUUID(uuid);
hostingNodeInstance.setID(uuid);
List<EService> list = resourceRegistryClient.getRelatedResourcesFromReferenceResource(EService.class, Hosts.class, hostingNodeInstance, Direction.IN, true);
logger.debug("{}", list);
}