Fixed code to comply with uuid property rename to id

This commit is contained in:
Luca Frosini 2023-04-28 11:46:55 +02:00
parent d8d2a1a2d6
commit a7fcf00921
2 changed files with 18 additions and 18 deletions

View File

@ -118,10 +118,10 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
protected String internalCreate(Context context) throws ContextAlreadyPresentException, ResourceRegistryException {
try {
UUID uuid = context.getUUID();
UUID uuid = context.getID();
if(uuid == null) {
uuid = UUIDManager.getInstance().generateValidUUID();
context.setUUID(uuid);
context.setID(uuid);
}
@ -220,7 +220,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
@Override
public Context read(Context context) throws ContextNotFoundException, ResourceRegistryException {
return read(context.getUUID());
return read(context.getID());
}
@Override
@ -234,7 +234,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
throw new RuntimeException(e);
}
forceCacheRefresh();
Context c = contextCache.getContextByUUID(context.getUUID());
Context c = contextCache.getContextByUUID(context.getID());
if(c!=null){
context = c;
}else {
@ -291,7 +291,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
String contextString = ElementMapper.marshal(context);
logger.trace("Going to update {}", contextString);
UUID uuid = context.getUUID();
UUID uuid = context.getID();
GXHTTPStringRequest gxHTTPStringRequest = getGXHTTPStringRequest();
gxHTTPStringRequest.header(ACCEPT_HTTP_HEADER_KEY, GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
@ -346,7 +346,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
@Override
public boolean delete(Context context) throws ContextNotFoundException, ResourceRegistryException {
return delete(context.getUUID());
return delete(context.getID());
}
@Override

View File

@ -42,10 +42,10 @@ public class ResourceRegistryContextClientTest extends ContextTest {
public static void checkUUIDAndMetadata(IdentifiableElement er, UUID uuid, boolean create) {
Assert.assertTrue(er.getMetadata() != null);
Assert.assertTrue(er.getUUID() != null);
Assert.assertTrue(er.getID() != null);
if(uuid != null) {
Assert.assertTrue(er.getUUID().compareTo(uuid) == 0);
Assert.assertTrue(er.getID().compareTo(uuid) == 0);
}
String user = getUser();
@ -63,7 +63,7 @@ public class ResourceRegistryContextClientTest extends ContextTest {
protected void assertions(Context pre, Context post, boolean checkParent, boolean create) {
if(checkParent) {
if(pre.getMetadata() != null) {
checkUUIDAndMetadata(post, pre.getUUID(), create);
checkUUIDAndMetadata(post, pre.getID(), create);
} else {
checkUUIDAndMetadata(post, null, create);
}
@ -80,8 +80,8 @@ public class ResourceRegistryContextClientTest extends ContextTest {
protected Context read(UUID uuid) throws ResourceRegistryException, IOException {
Context c = resourceRegistryContextClient.read(uuid);
Assert.assertTrue(c.getMetadata() != null);
Assert.assertTrue(c.getUUID() != null);
Assert.assertTrue(c.getUUID().compareTo(uuid) == 0);
Assert.assertTrue(c.getID() != null);
Assert.assertTrue(c.getID().compareTo(uuid) == 0);
return c;
}
@ -105,7 +105,7 @@ public class ResourceRegistryContextClientTest extends ContextTest {
}
protected boolean delete(Context context) throws ResourceRegistryException {
return delete(context.getUUID());
return delete(context.getID());
}
protected void invalidCreate(Context context) throws ResourceRegistryException, IOException {
@ -317,7 +317,7 @@ public class ResourceRegistryContextClientTest extends ContextTest {
delete(contextA5);
} catch(ContextNotFoundException e) {
logger.debug("The context with uuid {} was not found. (Was already deleted)",
contextA5.getUUID());
contextA5.getID());
}
delete(contextB3);
@ -441,11 +441,11 @@ public class ResourceRegistryContextClientTest 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;
@ -456,9 +456,9 @@ public class ResourceRegistryContextClientTest 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));
}
}
@ -466,7 +466,7 @@ public class ResourceRegistryContextClientTest extends ContextTest {
logger.debug("Current context : {}", currentContext);
for(Context c : contexts) {
UUID uuid = c.getUUID();
UUID uuid = c.getID();
Context context = resourceRegistryContextClient.read(uuid);
String fullName = ContextCache.getInstance().getContextFullNameByUUID(uuid);
logger.debug("{} - {} : {}", uuid, fullName, context);