Fixed code to comply with uuid property rename to id

This commit is contained in:
Luca Frosini 2023-04-28 11:43:48 +02:00
parent 5638c99feb
commit 7d7b9478bb
28 changed files with 116 additions and 116 deletions

View File

@ -130,7 +130,7 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
select.append(getName()); select.append(getName());
select.append("\""); select.append("\"");
select.append(QueryLogicalOperator.AND.getLogicalOperator()); select.append(QueryLogicalOperator.AND.getLogicalOperator());
select.append(IdentifiableElement.UUID_PROPERTY); select.append(IdentifiableElement.ID_PROPERTY);
select.append(QueryConditionalOperator.NE.getConditionalOperator()); select.append(QueryConditionalOperator.NE.getConditionalOperator());
select.append("\""); select.append("\"");
select.append(parentContext.uuid); select.append(parentContext.uuid);

View File

@ -142,7 +142,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
this.ignoreKeys = new HashSet<String>(); this.ignoreKeys = new HashSet<String>();
this.ignoreKeys.add(Element.TYPE_PROPERTY); this.ignoreKeys.add(Element.TYPE_PROPERTY);
this.ignoreKeys.add(Element.SUPERTYPES_PROPERTY); this.ignoreKeys.add(Element.SUPERTYPES_PROPERTY);
this.ignoreKeys.add(IdentifiableElement.UUID_PROPERTY); this.ignoreKeys.add(IdentifiableElement.ID_PROPERTY);
this.ignoreKeys.add(IdentifiableElement.METADATA_PROPERTY); this.ignoreKeys.add(IdentifiableElement.METADATA_PROPERTY);
this.ignoreStartWithKeys = new HashSet<String>(); this.ignoreStartWithKeys = new HashSet<String>();
@ -407,7 +407,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
/* Add first these key to provide an order in Json */ /* Add first these key to provide an order in Json */
List<String> keysToAddFirst = new ArrayList<>(); List<String> keysToAddFirst = new ArrayList<>();
keysToAddFirst.add(IdentifiableElement.UUID_PROPERTY); keysToAddFirst.add(IdentifiableElement.ID_PROPERTY);
keysToAddFirst.add(IdentifiableElement.METADATA_PROPERTY); keysToAddFirst.add(IdentifiableElement.METADATA_PROPERTY);
keysToAddFirst.add(Relation.PROPAGATION_CONSTRAINT_PROPERTY); keysToAddFirst.add(Relation.PROPAGATION_CONSTRAINT_PROPERTY);
@ -475,7 +475,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
element = reallyCreate(); element = reallyCreate();
element.setProperty(IdentifiableElement.UUID_PROPERTY, uuid.toString()); element.setProperty(IdentifiableElement.ID_PROPERTY, uuid.toString());
MetadataUtility.addMetadata(element); MetadataUtility.addMetadata(element);
@ -1180,7 +1180,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
return metadataJson; return metadataJson;
} }
if(key.compareTo(IdentifiableElement.UUID_PROPERTY) == 0 ) { if(key.compareTo(IdentifiableElement.ID_PROPERTY) == 0 ) {
return new TextNode(object.toString()); return new TextNode(object.toString());
} }

View File

@ -170,7 +170,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
try { try {
retrieveElementFromAnyContext(); retrieveElementFromAnyContext();
throw getSpecificAvailableInAnotherContextException(typeName == null ? accessType.getName() throw getSpecificAvailableInAnotherContextException(typeName == null ? accessType.getName()
: typeName + " with UUID " + uuid + " is available in another " : typeName + " with ID " + uuid + " is available in another "
+ Context.class.getSimpleName()); + Context.class.getSimpleName());
} catch(AvailableInAnotherContextException e1) { } catch(AvailableInAnotherContextException e1) {
throw e1; throw e1;
@ -713,7 +713,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
ArrayNode arrayNode = objectMapper.createArrayNode(); ArrayNode arrayNode = objectMapper.createArrayNode();
if(referenceUUID != null) { if(referenceUUID != null) {
constraint.put(Entity.UUID_PROPERTY, referenceUUID.toString()); constraint.put(Entity.ID_PROPERTY, referenceUUID.toString());
} }
// TODO check types // TODO check types
@ -792,8 +792,8 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
EntityManagement<?,?> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(), EntityManagement<?,?> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
oDatabaseDocument, vertex); oDatabaseDocument, vertex);
try { try {
if(constraint.containsKey(Entity.UUID_PROPERTY)) { if(constraint.containsKey(Entity.ID_PROPERTY)) {
String uuid = constraint.get(Entity.UUID_PROPERTY); String uuid = constraint.get(Entity.ID_PROPERTY);
if(entityManagement.getUUID().compareTo(UUID.fromString(uuid)) == 0) { if(entityManagement.getUUID().compareTo(UUID.fromString(uuid)) == 0) {
continue; continue;
} }

View File

@ -64,9 +64,9 @@ public class SharingManager {
* The the body is the following * The the body is the following
* *
* [ * [
* {"type" : "HostingNode", "uuid" : "16032d09-3823-444e-a1ff-a67de4f350a8" }, * {"type" : "HostingNode", "id" : "16032d09-3823-444e-a1ff-a67de4f350a8" },
* {"type" : "Hosts", "uuid" : "97ab8a6b-6b1b-4868-b8fc-ba48d0439ba9"}, * {"type" : "Hosts", "id" : "97ab8a6b-6b1b-4868-b8fc-ba48d0439ba9"},
* {"type" : "EService", "uuid" : "d3b1a29b-aa70-4a5a-be83-361a4209dd3e"} * {"type" : "EService", "id" : "d3b1a29b-aa70-4a5a-be83-361a4209dd3e"}
* ] * ]
* *
* *

View File

@ -534,7 +534,7 @@ public class TypeManagement {
String propertyName = newPropertyDefinition.getName(); String propertyName = newPropertyDefinition.getName();
if(propertyName.compareTo(IdentifiableElement.UUID_PROPERTY)==0 || if(propertyName.compareTo(IdentifiableElement.ID_PROPERTY)==0 ||
propertyName.compareTo(IdentifiableElement.METADATA_PROPERTY)==0 || propertyName.compareTo(IdentifiableElement.METADATA_PROPERTY)==0 ||
propertyName.compareTo(Relation.PROPAGATION_CONSTRAINT_PROPERTY)==0) { propertyName.compareTo(Relation.PROPAGATION_CONSTRAINT_PROPERTY)==0) {
continue; continue;

View File

@ -119,7 +119,7 @@ public class OrientDBUtility {
} }
// TODO Rewrite using Gremlin // TODO Rewrite using Gremlin
String select = "SELECT FROM " + elementType + " WHERE " + IdentifiableElement.UUID_PROPERTY + " = \"" + uuid.toString() + "\""; String select = "SELECT FROM " + elementType + " WHERE " + IdentifiableElement.ID_PROPERTY + " = \"" + uuid.toString() + "\"";
OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>()); OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>());

View File

@ -13,7 +13,7 @@ import com.orientechnologies.orient.core.record.OElement;
public class UUIDUtility extends org.gcube.informationsystem.utils.UUIDUtility { public class UUIDUtility extends org.gcube.informationsystem.utils.UUIDUtility {
public static UUID getUUID(OElement element) throws ResourceRegistryException { public static UUID getUUID(OElement element) throws ResourceRegistryException {
String uuidString = element.getProperty(IdentifiableElement.UUID_PROPERTY); String uuidString = element.getProperty(IdentifiableElement.ID_PROPERTY);
UUID uuid = UUID.fromString(uuidString); UUID uuid = UUID.fromString(uuidString);
return uuid; return uuid;
} }

View File

@ -47,10 +47,10 @@ public class ContextManagementTest extends ContextTest {
public static void checkUUUIDAndMetadata(IdentifiableElement er, UUID uuid, boolean create) { public static void checkUUUIDAndMetadata(IdentifiableElement er, UUID uuid, boolean create) {
Assert.assertTrue(er.getMetadata() != null); Assert.assertTrue(er.getMetadata() != null);
Assert.assertTrue(er.getUUID() != null); Assert.assertTrue(er.getID() != null);
if(uuid != null) { if(uuid != null) {
Assert.assertTrue(er.getUUID().compareTo(uuid) == 0); Assert.assertTrue(er.getID().compareTo(uuid) == 0);
} }
String user = MetadataUtility.getUser(); String user = MetadataUtility.getUser();
@ -68,7 +68,7 @@ public class ContextManagementTest extends ContextTest {
throws ResourceRegistryException { throws ResourceRegistryException {
if(checkParent) { if(checkParent) {
if(pre.getMetadata() != null) { if(pre.getMetadata() != null) {
checkUUUIDAndMetadata(post, pre.getUUID(), create); checkUUUIDAndMetadata(post, pre.getID(), create);
} else { } else {
checkUUUIDAndMetadata(post, null, create); checkUUUIDAndMetadata(post, null, create);
} }
@ -148,7 +148,7 @@ public class ContextManagementTest extends ContextTest {
logger.debug("Created {}", contextString); logger.debug("Created {}", contextString);
Context c = ElementMapper.unmarshal(Context.class, contextString); Context c = ElementMapper.unmarshal(Context.class, contextString);
assertions(context, c, true, true); assertions(context, c, true, true);
roleUserAssertions(c.getUUID(), null, false); roleUserAssertions(c.getID(), null, false);
return c; return c;
} }
@ -159,7 +159,7 @@ public class ContextManagementTest extends ContextTest {
logger.debug("Updated {}", contextString); logger.debug("Updated {}", contextString);
Context c = ElementMapper.unmarshal(Context.class, contextString); Context c = ElementMapper.unmarshal(Context.class, contextString);
assertions(context, c, true, false); assertions(context, c, true, false);
roleUserAssertions(c.getUUID(), null, false); roleUserAssertions(c.getID(), null, false);
return c; return c;
} }
@ -180,7 +180,7 @@ public class ContextManagementTest extends ContextTest {
} }
protected void delete(Context context) throws ResourceRegistryException { protected void delete(Context context) throws ResourceRegistryException {
delete(context.getUUID()); delete(context.getID());
} }
protected void invalidCreate(Context context) throws ResourceRegistryException, IOException { protected void invalidCreate(Context context) throws ResourceRegistryException, IOException {
@ -420,7 +420,7 @@ public class ContextManagementTest extends ContextTest {
delete(contextA5); delete(contextA5);
} catch(ContextNotFoundException e) { } catch(ContextNotFoundException e) {
logger.debug("The context with uuid {} was not found. (Was already deleted)", logger.debug("The context with uuid {} was not found. (Was already deleted)",
contextA5.getUUID()); contextA5.getID());
} }
delete(contextB3); delete(contextB3);
@ -435,7 +435,7 @@ public class ContextManagementTest extends ContextTest {
// ________A1________ // ________A1________
Context contextC = new ContextImpl(CTX_NAME_C); Context contextC = new ContextImpl(CTX_NAME_C);
contextC.setUUID(contextA1.getUUID()); contextC.setID(contextA1.getID());
invalidCreate(contextC); invalidCreate(contextC);
delete(contextA1); delete(contextA1);
@ -480,7 +480,7 @@ public class ContextManagementTest extends ContextTest {
Context childContext = child.getTarget(); Context childContext = child.getTarget();
Assert.assertTrue(childContext.getParent().getSource() == context); Assert.assertTrue(childContext.getParent().getSource() == context);
} }
roleUserAssertions(context.getUUID(), null, false); roleUserAssertions(context.getID(), null, false);
} }
} }
@ -509,11 +509,11 @@ public class ContextManagementTest extends ContextTest {
List<Context> contextsFromCache = contextCache.getContexts(); List<Context> contextsFromCache = contextCache.getContexts();
for(Context c : contextsFromCache) { for(Context c : contextsFromCache) {
UUID uuid = c.getUUID(); UUID uuid = c.getID();
if(c.getParent()!=null) { if(c.getParent()!=null) {
IsParentOf isParentOf = c.getParent(); IsParentOf isParentOf = c.getParent();
Context parentContext = isParentOf.getSource(); Context parentContext = isParentOf.getSource();
UUID parentUUID = parentContext.getUUID(); UUID parentUUID = parentContext.getID();
Assert.assertTrue(parentContext.getName().compareTo(contextCache.getContextByUUID(parentUUID).getName())==0); Assert.assertTrue(parentContext.getName().compareTo(contextCache.getContextByUUID(parentUUID).getName())==0);
List<IsParentOf> children = parentContext.getChildren(); List<IsParentOf> children = parentContext.getChildren();
boolean found = false; boolean found = false;
@ -524,9 +524,9 @@ public class ContextManagementTest extends ContextTest {
} }
} }
Assert.assertTrue(found); 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 { }else {
logger.debug("{} : {}", c.getUUID(), contextCache.getContextFullNameByUUID(uuid)); logger.debug("{} : {}", c.getID(), contextCache.getContextFullNameByUUID(uuid));
} }
} }
@ -534,7 +534,7 @@ public class ContextManagementTest extends ContextTest {
logger.debug("Current context : {}", currentContext); logger.debug("Current context : {}", currentContext);
for(Context c : contexts) { for(Context c : contexts) {
UUID uuid = c.getUUID(); UUID uuid = c.getID();
Context context = read(uuid); Context context = read(uuid);
String fullName = ContextCache.getInstance().getContextFullNameByUUID(uuid); String fullName = ContextCache.getInstance().getContextFullNameByUUID(uuid);
logger.debug("{} - {} : {}", uuid, fullName, context); logger.debug("{} - {} : {}", uuid, fullName, context);

View File

@ -218,11 +218,11 @@ public class ERManagementTest extends ContextTest {
} }
public static void checkUUIDAndMetadata(IdentifiableElement identifiableElement, IdentifiableElement createdIdentifiableElement) { public static void checkUUIDAndMetadata(IdentifiableElement identifiableElement, IdentifiableElement createdIdentifiableElement) {
UUID createdUUID = createdIdentifiableElement.getUUID(); UUID createdUUID = createdIdentifiableElement.getID();
Assert.assertTrue(createdUUID!=null); Assert.assertTrue(createdUUID!=null);
if(identifiableElement.getUUID()!=null) { if(identifiableElement.getID()!=null) {
Assert.assertTrue(createdUUID.compareTo(identifiableElement.getUUID())==0); Assert.assertTrue(createdUUID.compareTo(identifiableElement.getID())==0);
} }
Metadata createdMetadata = createdIdentifiableElement.getMetadata(); Metadata createdMetadata = createdIdentifiableElement.getMetadata();
@ -329,8 +329,8 @@ public class ERManagementTest extends ContextTest {
ResourceManagement resourceManagement = new ResourceManagement(); ResourceManagement resourceManagement = new ResourceManagement();
resourceManagement.setElementType(r.getTypeName()); resourceManagement.setElementType(r.getTypeName());
resourceManagement.setJson(ElementMapper.marshal(r)); resourceManagement.setJson(ElementMapper.marshal(r));
if(r.getUUID()!=null) { if(r.getID()!=null) {
resourceManagement.setUUID(r.getUUID()); resourceManagement.setUUID(r.getID());
} }
return resourceManagement; return resourceManagement;
} }
@ -339,8 +339,8 @@ public class ERManagementTest extends ContextTest {
IsRelatedToManagement isRelatedToManagement = new IsRelatedToManagement(); IsRelatedToManagement isRelatedToManagement = new IsRelatedToManagement();
isRelatedToManagement.setElementType(isRelatedTo.getTypeName()); isRelatedToManagement.setElementType(isRelatedTo.getTypeName());
isRelatedToManagement.setJson(ElementMapper.marshal(isRelatedTo)); isRelatedToManagement.setJson(ElementMapper.marshal(isRelatedTo));
if(isRelatedTo.getUUID()!=null) { if(isRelatedTo.getID()!=null) {
isRelatedToManagement.setUUID(isRelatedTo.getUUID()); isRelatedToManagement.setUUID(isRelatedTo.getID());
} }
return isRelatedToManagement; return isRelatedToManagement;
} }
@ -488,7 +488,7 @@ public class ERManagementTest extends ContextTest {
Assert.assertTrue(cpuFacet.getModel().compareTo(createdCpuFacet.getModel()) == 0); Assert.assertTrue(cpuFacet.getModel().compareTo(createdCpuFacet.getModel()) == 0);
Assert.assertTrue(cpuFacet.getVendor().compareTo(createdCpuFacet.getVendor()) == 0); Assert.assertTrue(cpuFacet.getVendor().compareTo(createdCpuFacet.getVendor()) == 0);
UUID uuid = createdCpuFacet.getUUID(); UUID uuid = createdCpuFacet.getID();
FacetManagement facetManagement = new FacetManagement(); FacetManagement facetManagement = new FacetManagement();
facetManagement.setElementType(createdCpuFacet.getTypeName()); facetManagement.setElementType(createdCpuFacet.getTypeName());
@ -500,7 +500,7 @@ public class ERManagementTest extends ContextTest {
Assert.assertTrue(cpuFacet.getClockSpeed().compareTo(readCpuFacet.getClockSpeed()) == 0); Assert.assertTrue(cpuFacet.getClockSpeed().compareTo(readCpuFacet.getClockSpeed()) == 0);
Assert.assertTrue(cpuFacet.getModel().compareTo(readCpuFacet.getModel()) == 0); Assert.assertTrue(cpuFacet.getModel().compareTo(readCpuFacet.getModel()) == 0);
Assert.assertTrue(cpuFacet.getVendor().compareTo(readCpuFacet.getVendor()) == 0); Assert.assertTrue(cpuFacet.getVendor().compareTo(readCpuFacet.getVendor()) == 0);
Assert.assertTrue(uuid.compareTo(readCpuFacet.getUUID()) == 0); Assert.assertTrue(uuid.compareTo(readCpuFacet.getID()) == 0);
String newVendor = "Intel"; String newVendor = "Intel";
String newClockSpeed = "2 GHz"; String newClockSpeed = "2 GHz";
@ -524,7 +524,7 @@ public class ERManagementTest extends ContextTest {
Assert.assertTrue(updatedCpuFacet.getVendor().compareTo(newVendor) == 0); Assert.assertTrue(updatedCpuFacet.getVendor().compareTo(newVendor) == 0);
Assert.assertTrue(((String) updatedCpuFacet.getAdditionalProperty(additionPropertyKey)) Assert.assertTrue(((String) updatedCpuFacet.getAdditionalProperty(additionPropertyKey))
.compareTo((String) readCpuFacet.getAdditionalProperty(additionPropertyKey)) == 0); .compareTo((String) readCpuFacet.getAdditionalProperty(additionPropertyKey)) == 0);
Assert.assertTrue(uuid.compareTo(updatedCpuFacet.getUUID()) == 0); Assert.assertTrue(uuid.compareTo(updatedCpuFacet.getID()) == 0);
String user = ContextTest.getUser(); String user = ContextTest.getUser();
Assert.assertTrue(updatedCpuFacet.getMetadata().getLastUpdateBy().compareTo(user) == 0); Assert.assertTrue(updatedCpuFacet.getMetadata().getLastUpdateBy().compareTo(user) == 0);
@ -540,7 +540,7 @@ public class ERManagementTest extends ContextTest {
Assert.assertTrue(updatedCpuFacet.getVendor().compareTo(readUpdatedCpuFacet.getVendor()) == 0); Assert.assertTrue(updatedCpuFacet.getVendor().compareTo(readUpdatedCpuFacet.getVendor()) == 0);
Assert.assertTrue(((String) updatedCpuFacet.getAdditionalProperty(additionPropertyKey)) Assert.assertTrue(((String) updatedCpuFacet.getAdditionalProperty(additionPropertyKey))
.compareTo((String) readUpdatedCpuFacet.getAdditionalProperty(additionPropertyKey)) == 0); .compareTo((String) readUpdatedCpuFacet.getAdditionalProperty(additionPropertyKey)) == 0);
Assert.assertTrue(uuid.compareTo(updatedCpuFacet.getUUID()) == 0); Assert.assertTrue(uuid.compareTo(updatedCpuFacet.getID()) == 0);
facetManagement = new FacetManagement(); facetManagement = new FacetManagement();
facetManagement.setElementType(readCpuFacet.getTypeName()); facetManagement.setElementType(readCpuFacet.getTypeName());

View File

@ -61,8 +61,8 @@ public class InvalidOperationTest extends ERManagementTest {
*/ */
IsRelatedToManagement isRelatedToManagement = new IsRelatedToManagement(); IsRelatedToManagement isRelatedToManagement = new IsRelatedToManagement();
isRelatedToManagement.setElementType(Activates.NAME); isRelatedToManagement.setElementType(Activates.NAME);
String json = ACTIVATES.replace("CONFIGURATION_UUID", configuration.getUUID().toString()); String json = ACTIVATES.replace("CONFIGURATION_UUID", configuration.getID().toString());
json = json.replace("ESERVICE_UUID", eService.getUUID().toString()); json = json.replace("ESERVICE_UUID", eService.getID().toString());
isRelatedToManagement.setJson(json); isRelatedToManagement.setJson(json);
isRelatedToManagement.create(); isRelatedToManagement.create();
}finally { }finally {
@ -167,7 +167,7 @@ public class InvalidOperationTest extends ERManagementTest {
ConsistsOfManagement consistsOfManagement = new ConsistsOfManagement(); ConsistsOfManagement consistsOfManagement = new ConsistsOfManagement();
consistsOfManagement.setElementType(isIdentifiedBy.getTypeName()); consistsOfManagement.setElementType(isIdentifiedBy.getTypeName());
consistsOfManagement.setUUID(isIdentifiedBy.getUUID()); consistsOfManagement.setUUID(isIdentifiedBy.getID());
consistsOfManagement.delete(); consistsOfManagement.delete();
}finally { }finally {
ERManagementTest.deleteResource(eService); ERManagementTest.deleteResource(eService);
@ -182,12 +182,12 @@ public class InvalidOperationTest extends ERManagementTest {
IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedBy = (IsIdentifiedBy<EService, SoftwareFacet>) eService.getConsistsOf(IsIdentifiedBy.class).get(0); IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedBy = (IsIdentifiedBy<EService, SoftwareFacet>) eService.getConsistsOf(IsIdentifiedBy.class).get(0);
ConsistsOfManagement consistsOfManagement = new ConsistsOfManagement(); ConsistsOfManagement consistsOfManagement = new ConsistsOfManagement();
consistsOfManagement.setElementType(IsIdentifiedBy.NAME); consistsOfManagement.setElementType(IsIdentifiedBy.NAME);
consistsOfManagement.setUUID(isIdentifiedBy.getUUID()); consistsOfManagement.setUUID(isIdentifiedBy.getID());
SoftwareFacet softwareFacet = isIdentifiedBy.getTarget(); SoftwareFacet softwareFacet = isIdentifiedBy.getTarget();
FacetManagement facetManagement = new FacetManagement(); FacetManagement facetManagement = new FacetManagement();
facetManagement.setElementType(SoftwareFacet.NAME); facetManagement.setElementType(SoftwareFacet.NAME);
facetManagement.setUUID(softwareFacet.getUUID()); facetManagement.setUUID(softwareFacet.getID());
try { try {
facetManagement.delete(); facetManagement.delete();
@ -201,14 +201,14 @@ public class InvalidOperationTest extends ERManagementTest {
public void testCreateConsistsOfBeetweenResources() throws Exception { public void testCreateConsistsOfBeetweenResources() throws Exception {
Map<String, Resource> map = ERManagementTest.createHostingNodeAndEService(); Map<String, Resource> map = ERManagementTest.createHostingNodeAndEService();
UUID hostingNodeUUID = map.get(HostingNode.NAME).getUUID(); UUID hostingNodeUUID = map.get(HostingNode.NAME).getID();
UUID eServiceUUID = map.get(EService.NAME).getUUID(); UUID eServiceUUID = map.get(EService.NAME).getID();
HostingNode hostingNode = new HostingNodeImpl(); HostingNode hostingNode = new HostingNodeImpl();
hostingNode.setUUID(hostingNodeUUID); hostingNode.setID(hostingNodeUUID);
SimpleFacet fakeEServiceAsSimpleFacet = new SimpleFacetImpl(); SimpleFacet fakeEServiceAsSimpleFacet = new SimpleFacetImpl();
fakeEServiceAsSimpleFacet.setUUID(eServiceUUID); fakeEServiceAsSimpleFacet.setID(eServiceUUID);
ConsistsOf<HostingNode, SimpleFacet> consistsOf = new ConsistsOfImpl<HostingNode, SimpleFacet>(hostingNode, fakeEServiceAsSimpleFacet); ConsistsOf<HostingNode, SimpleFacet> consistsOf = new ConsistsOfImpl<HostingNode, SimpleFacet>(hostingNode, fakeEServiceAsSimpleFacet);

View File

@ -93,7 +93,7 @@ public class SmartgearResourcesTest extends ERManagementTest {
UUID uuid = UUIDManager.getInstance().generateValidUUID(); UUID uuid = UUIDManager.getInstance().generateValidUUID();
HostingNode hostingNode = new HostingNodeImpl(); HostingNode hostingNode = new HostingNodeImpl();
hostingNode.setUUID(uuid); hostingNode.setID(uuid);
NetworkingFacet networkingFacet = new NetworkingFacetImpl(); NetworkingFacet networkingFacet = new NetworkingFacetImpl();
try { try {

View File

@ -59,7 +59,7 @@ public class AddToContextTest extends MultiContextTest {
IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedBy = (IsIdentifiedBy<EService, SoftwareFacet>) eService.getConsistsOf(IsIdentifiedBy.class).get(0); IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedBy = (IsIdentifiedBy<EService, SoftwareFacet>) eService.getConsistsOf(IsIdentifiedBy.class).get(0);
ConsistsOfManagement consistsOfManagement = new ConsistsOfManagement(); ConsistsOfManagement consistsOfManagement = new ConsistsOfManagement();
consistsOfManagement.setElementType(IsIdentifiedBy.NAME); consistsOfManagement.setElementType(IsIdentifiedBy.NAME);
consistsOfManagement.setUUID(isIdentifiedBy.getUUID()); consistsOfManagement.setUUID(isIdentifiedBy.getID());
try { try {
consistsOfManagement.removeFromContext(ContextUtility.getCurrentSecurityContext().getUUID()); consistsOfManagement.removeFromContext(ContextUtility.getCurrentSecurityContext().getUUID());
@ -74,7 +74,7 @@ public class AddToContextTest extends MultiContextTest {
SoftwareFacet softwareFacet = isIdentifiedBy.getTarget(); SoftwareFacet softwareFacet = isIdentifiedBy.getTarget();
FacetManagement facetManagement = new FacetManagement(); FacetManagement facetManagement = new FacetManagement();
facetManagement.setElementType(SoftwareFacet.NAME); facetManagement.setElementType(SoftwareFacet.NAME);
facetManagement.setUUID(softwareFacet.getUUID()); facetManagement.setUUID(softwareFacet.getID());
try { try {
facetManagement.removeFromContext(ContextUtility.getCurrentSecurityContext().getUUID()); facetManagement.removeFromContext(ContextUtility.getCurrentSecurityContext().getUUID());
@ -92,7 +92,7 @@ public class AddToContextTest extends MultiContextTest {
protected Dataset createDataset(String id, String uuidString) throws Exception { protected Dataset createDataset(String id, String uuidString) throws Exception {
Dataset dataset = new DatasetImpl(); Dataset dataset = new DatasetImpl();
dataset.setUUID(UUID.fromString(uuidString)); dataset.setID(UUID.fromString(uuidString));
IdentifierFacet identifierFacet = new IdentifierFacetImpl(); IdentifierFacet identifierFacet = new IdentifierFacetImpl();
identifierFacet.setValue(id); identifierFacet.setValue(id);
@ -138,7 +138,7 @@ public class AddToContextTest extends MultiContextTest {
protected IsCorrelatedTo<Dataset, Dataset> createIsCorrelatedTo(Dataset source, Dataset target, String uuid) throws Exception { protected IsCorrelatedTo<Dataset, Dataset> createIsCorrelatedTo(Dataset source, Dataset target, String uuid) throws Exception {
PropagationConstraint propagationConstraint = getPropagationConstraint(); PropagationConstraint propagationConstraint = getPropagationConstraint();
IsCorrelatedTo<Dataset, Dataset> isCorrelatedTo = new IsCorrelatedToImpl<Dataset, Dataset>(source, target, propagationConstraint); IsCorrelatedTo<Dataset, Dataset> isCorrelatedTo = new IsCorrelatedToImpl<Dataset, Dataset>(source, target, propagationConstraint);
isCorrelatedTo.setUUID(UUID.fromString(uuid)); isCorrelatedTo.setID(UUID.fromString(uuid));
IsRelatedToManagement isRelatedToManagement = getIsRelatedToManagement(isCorrelatedTo); IsRelatedToManagement isRelatedToManagement = getIsRelatedToManagement(isCorrelatedTo);
String json = isRelatedToManagement.create(); String json = isRelatedToManagement.create();
@ -161,7 +161,7 @@ public class AddToContextTest extends MultiContextTest {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<String,String> contextsR1 = (Map<String, String>) r1.getMetadata().getAdditionalProperty(Metadata.__CONTEXTS); Map<String,String> contextsR1 = (Map<String, String>) r1.getMetadata().getAdditionalProperty(Metadata.__CONTEXTS);
Set<String> contextsR1Fullname = new HashSet<>(contextsR1.values()); Set<String> contextsR1Fullname = new HashSet<>(contextsR1.values());
logger.info("Contexts of {} with UUID {} and Id {} are {}", Dataset.NAME, r1.getUUID(), ((IdentifierFacet)r1.getIdentificationFacets().get(0)).getValue(), contextsR1Fullname); logger.info("Contexts of {} with UUID {} and Id {} are {}", Dataset.NAME, r1.getID(), ((IdentifierFacet)r1.getIdentificationFacets().get(0)).getValue(), contextsR1Fullname);
Assert.assertTrue(contextsR1.size()==expectedContextSize); Assert.assertTrue(contextsR1.size()==expectedContextSize);
ContextUtility.getHierarchicalMode().set(false); ContextUtility.getHierarchicalMode().set(false);

View File

@ -151,21 +151,21 @@ public class BasicTest extends MultiContextTest {
EService eService = ERManagementTest.createEService(); EService eService = ERManagementTest.createEService();
Map<UUID, IdentifiableElement> eServiceInstances = new HashMap<>(); Map<UUID, IdentifiableElement> eServiceInstances = new HashMap<>();
eServiceInstances.put(eService.getUUID(), eService); eServiceInstances.put(eService.getID(), eService);
for(ConsistsOf<?,?> consistsOf : eService.getConsistsOf()) { for(ConsistsOf<?,?> consistsOf : eService.getConsistsOf()) {
eServiceInstances.put(consistsOf.getUUID(), consistsOf); eServiceInstances.put(consistsOf.getID(), consistsOf);
eServiceInstances.put(consistsOf.getTarget().getUUID(), consistsOf.getTarget()); eServiceInstances.put(consistsOf.getTarget().getID(), consistsOf.getTarget());
} }
HostingNode hostingNode = ERManagementTest.createHostingNode(eService); HostingNode hostingNode = ERManagementTest.createHostingNode(eService);
UUID hostingNodeUUID = hostingNode.getUUID(); UUID hostingNodeUUID = hostingNode.getID();
Map<UUID, IdentifiableElement> hostingNodeInstances = new HashMap<>(); Map<UUID, IdentifiableElement> hostingNodeInstances = new HashMap<>();
hostingNodeInstances.put(hostingNodeUUID, hostingNode); hostingNodeInstances.put(hostingNodeUUID, hostingNode);
for(ConsistsOf<?,?> consistsOf : hostingNode.getConsistsOf()) { for(ConsistsOf<?,?> consistsOf : hostingNode.getConsistsOf()) {
hostingNodeInstances.put(consistsOf.getUUID(), consistsOf); hostingNodeInstances.put(consistsOf.getID(), consistsOf);
hostingNodeInstances.put(consistsOf.getTarget().getUUID(), consistsOf.getTarget()); hostingNodeInstances.put(consistsOf.getTarget().getID(), consistsOf.getTarget());
} }
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
@ -236,7 +236,7 @@ public class BasicTest extends MultiContextTest {
ResourceManagement resourceManagement = ERManagementTest.getResourceManagement(hostingNode); ResourceManagement resourceManagement = ERManagementTest.getResourceManagement(hostingNode);
try { try {
resourceManagement.read(); resourceManagement.read();
String error = String.format("{} with UUID {} should not be visible.", HostingNode.NAME, hostingNode.getUUID()); String error = String.format("{} with UUID {} should not be visible.", HostingNode.NAME, hostingNode.getID());
logger.trace(error); logger.trace(error);
throw new Exception(error); throw new Exception(error);
}catch (ResourceAvailableInAnotherContextException e) { }catch (ResourceAvailableInAnotherContextException e) {
@ -246,7 +246,7 @@ public class BasicTest extends MultiContextTest {
isRelatedToManagement = ERManagementTest.getIsRelatedToManagement(activates); isRelatedToManagement = ERManagementTest.getIsRelatedToManagement(activates);
try { try {
isRelatedToManagement.read(); isRelatedToManagement.read();
String error = String.format("{} with UUID {} should not be visible.", Activates.NAME, activates.getUUID()); String error = String.format("{} with UUID {} should not be visible.", Activates.NAME, activates.getID());
logger.trace(error); logger.trace(error);
throw new Exception(error); throw new Exception(error);
}catch (RelationAvailableInAnotherContextException e) { }catch (RelationAvailableInAnotherContextException e) {
@ -256,7 +256,7 @@ public class BasicTest extends MultiContextTest {
resourceManagement = ERManagementTest.getResourceManagement(eService); resourceManagement = ERManagementTest.getResourceManagement(eService);
try { try {
resourceManagement.read(); resourceManagement.read();
String error = String.format("{} with UUID {} should not be visible.", EService.NAME, eService.getUUID()); String error = String.format("{} with UUID {} should not be visible.", EService.NAME, eService.getID());
logger.trace(error); logger.trace(error);
throw new Exception(error); throw new Exception(error);
}catch (ResourceAvailableInAnotherContextException e) { }catch (ResourceAvailableInAnotherContextException e) {
@ -287,7 +287,7 @@ public class BasicTest extends MultiContextTest {
try { try {
resourceManagement.read(); resourceManagement.read();
String error = String.format("{} with UUID {} should not be found.", HostingNode.NAME, hostingNode.getUUID()); String error = String.format("{} with UUID {} should not be found.", HostingNode.NAME, hostingNode.getID());
logger.trace(error); logger.trace(error);
throw new Exception(error); throw new Exception(error);
}catch (ResourceNotFoundException e) { }catch (ResourceNotFoundException e) {
@ -297,7 +297,7 @@ public class BasicTest extends MultiContextTest {
IsRelatedToManagement isRelatedToManagement = ERManagementTest.getIsRelatedToManagement(activates); IsRelatedToManagement isRelatedToManagement = ERManagementTest.getIsRelatedToManagement(activates);
try { try {
isRelatedToManagement.read(); isRelatedToManagement.read();
String error = String.format("{} with UUID {} should not be found.", Activates.NAME, activates.getUUID()); String error = String.format("{} with UUID {} should not be found.", Activates.NAME, activates.getID());
logger.trace(error); logger.trace(error);
throw new Exception(error); throw new Exception(error);
}catch (IsRelatedToNotFoundException e) { }catch (IsRelatedToNotFoundException e) {
@ -307,7 +307,7 @@ public class BasicTest extends MultiContextTest {
resourceManagement = ERManagementTest.getResourceManagement(eService); resourceManagement = ERManagementTest.getResourceManagement(eService);
try { try {
resourceManagement.read(); resourceManagement.read();
String error = String.format("{} with UUID {} should not be found.", EService.NAME, eService.getUUID()); String error = String.format("{} with UUID {} should not be found.", EService.NAME, eService.getID());
logger.trace(error); logger.trace(error);
throw new Exception(error); throw new Exception(error);
}catch (ResourceNotFoundException e) { }catch (ResourceNotFoundException e) {

View File

@ -83,7 +83,7 @@ public class ComplexTest extends MultiContextTest {
for(Facet facet : hostingNode.getFacets()) { for(Facet facet : hostingNode.getFacets()) {
FacetManagement facetManagement = new FacetManagement(); FacetManagement facetManagement = new FacetManagement();
facetManagement.setUUID(facet.getUUID()); facetManagement.setUUID(facet.getID());
String typeName = TypeUtility.getTypeName(facet.getClass()); String typeName = TypeUtility.getTypeName(facet.getClass());
facetManagement.setElementType(typeName); facetManagement.setElementType(typeName);
String facetContexts = facetManagement.getContexts(); String facetContexts = facetManagement.getContexts();
@ -97,7 +97,7 @@ public class ComplexTest extends MultiContextTest {
} }
activatesManagement = new IsRelatedToManagement(); activatesManagement = new IsRelatedToManagement();
activatesManagement.setUUID(createdActivates.getUUID()); activatesManagement.setUUID(createdActivates.getID());
activatesManagement.setElementType(TypeUtility.getTypeName(createdActivates.getClass())); activatesManagement.setElementType(TypeUtility.getTypeName(createdActivates.getClass()));
String isRelatedToContexts = activatesManagement.getContexts(); String isRelatedToContexts = activatesManagement.getContexts();
logger.debug("Contexts of {} with UUID {} have the following UUID {}", Activates.NAME, activatesManagement.getUUID(), isRelatedToContexts); logger.debug("Contexts of {} with UUID {} have the following UUID {}", Activates.NAME, activatesManagement.getUUID(), isRelatedToContexts);

View File

@ -43,7 +43,7 @@ public class MultiContextTest extends ERManagementTest {
@SuppressWarnings({ "unchecked", "unused" }) @SuppressWarnings({ "unchecked", "unused" })
private Map<UUID, Element> getRemovedExpectedInstances(Resource r) throws Exception { private Map<UUID, Element> getRemovedExpectedInstances(Resource r) throws Exception {
Map<UUID, Element> expected = new HashMap<>(); Map<UUID, Element> expected = new HashMap<>();
expected.put(r.getUUID(), r); expected.put(r.getID(), r);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
List<IsRelatedTo> list = getOutcomingIsRelatedTo(r); List<IsRelatedTo> list = getOutcomingIsRelatedTo(r);
@ -51,16 +51,16 @@ public class MultiContextTest extends ERManagementTest {
for (IsRelatedTo<? extends Resource, ? extends Resource> isRelatedTo : list) { for (IsRelatedTo<? extends Resource, ? extends Resource> isRelatedTo : list) {
if (isRelatedTo.getPropagationConstraint().getRemoveConstraint() == RemoveConstraint.cascade) { if (isRelatedTo.getPropagationConstraint().getRemoveConstraint() == RemoveConstraint.cascade) {
expected.put(isRelatedTo.getUUID(), isRelatedTo); expected.put(isRelatedTo.getID(), isRelatedTo);
expected.putAll(getRemovedExpectedInstances(isRelatedTo.getTarget())); expected.putAll(getRemovedExpectedInstances(isRelatedTo.getTarget()));
} }
if (isRelatedTo.getPropagationConstraint().getRemoveConstraint() == RemoveConstraint.cascadeWhenOrphan) { if (isRelatedTo.getPropagationConstraint().getRemoveConstraint() == RemoveConstraint.cascadeWhenOrphan) {
expected.put(isRelatedTo.getUUID(), isRelatedTo); expected.put(isRelatedTo.getID(), isRelatedTo);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
List<IsRelatedTo> incoming = getIncomingIsRelatedTo(r); List<IsRelatedTo> incoming = getIncomingIsRelatedTo(r);
if(incoming.size()==1) { if(incoming.size()==1) {
Assert.assertTrue(incoming.get(0).getUUID().compareTo(isRelatedTo.getUUID())==0); Assert.assertTrue(incoming.get(0).getID().compareTo(isRelatedTo.getID())==0);
expected.putAll(getRemovedExpectedInstances(isRelatedTo.getTarget())); expected.putAll(getRemovedExpectedInstances(isRelatedTo.getTarget()));
} }
@ -70,9 +70,9 @@ public class MultiContextTest extends ERManagementTest {
for (ConsistsOf<? extends Resource, ? extends Facet> consistsOf : r.getConsistsOf()) { for (ConsistsOf<? extends Resource, ? extends Facet> consistsOf : r.getConsistsOf()) {
if (consistsOf.getPropagationConstraint().getRemoveConstraint() == RemoveConstraint.cascade || consistsOf if (consistsOf.getPropagationConstraint().getRemoveConstraint() == RemoveConstraint.cascade || consistsOf
.getPropagationConstraint().getRemoveConstraint() == RemoveConstraint.cascadeWhenOrphan) { .getPropagationConstraint().getRemoveConstraint() == RemoveConstraint.cascadeWhenOrphan) {
expected.put(consistsOf.getUUID(), consistsOf); expected.put(consistsOf.getID(), consistsOf);
Facet facet = consistsOf.getTarget(); Facet facet = consistsOf.getTarget();
expected.put(facet.getUUID(), facet); expected.put(facet.getID(), facet);
} }
} }
@ -154,7 +154,7 @@ public class MultiContextTest extends ERManagementTest {
resourceManagement.setElementType(Resource.NAME); resourceManagement.setElementType(Resource.NAME);
String resourceType = TypeMapper.getType(r); String resourceType = TypeMapper.getType(r);
UUID resourceUUID = r.getUUID(); UUID resourceUUID = r.getID();
// resourceManagement.setUUID(resourceUUID); // resourceManagement.setUUID(resourceUUID);
String ret = resourceManagement.query(IsRelatedTo.NAME, resourceType, resourceUUID, oDirection, true, String ret = resourceManagement.query(IsRelatedTo.NAME, resourceType, resourceUUID, oDirection, true,
@ -183,7 +183,7 @@ public class MultiContextTest extends ERManagementTest {
Resource r = ElementMapper.unmarshal(resource.getClass(), json); Resource r = ElementMapper.unmarshal(resource.getClass(), json);
Map<UUID, Element> expected = new HashMap<>(); Map<UUID, Element> expected = new HashMap<>();
expected.put(r.getUUID(), r); expected.put(r.getID(), r);
RelationConstraintEvaluator relationConstraintEvaluator = new RelationConstraintEvaluator() { RelationConstraintEvaluator relationConstraintEvaluator = new RelationConstraintEvaluator() {
@ -203,15 +203,15 @@ public class MultiContextTest extends ERManagementTest {
for (IsRelatedTo<? extends Resource, ? extends Resource> isRelatedTo : r.getIsRelatedTo()) { for (IsRelatedTo<? extends Resource, ? extends Resource> isRelatedTo : r.getIsRelatedTo()) {
if (isRelatedTo.getPropagationConstraint().getAddConstraint() == AddConstraint.propagate) { if (isRelatedTo.getPropagationConstraint().getAddConstraint() == AddConstraint.propagate) {
expected.put(isRelatedTo.getUUID(), isRelatedTo); expected.put(isRelatedTo.getID(), isRelatedTo);
expected.putAll(getExpectedInstancesAddToContext(isRelatedTo.getTarget())); expected.putAll(getExpectedInstancesAddToContext(isRelatedTo.getTarget()));
} }
} }
for (ConsistsOf<? extends Resource, ? extends Facet> consistsOf : r.getConsistsOf()) { for (ConsistsOf<? extends Resource, ? extends Facet> consistsOf : r.getConsistsOf()) {
if (consistsOf.getPropagationConstraint().getAddConstraint() == AddConstraint.propagate) { if (consistsOf.getPropagationConstraint().getAddConstraint() == AddConstraint.propagate) {
expected.put(consistsOf.getUUID(), consistsOf); expected.put(consistsOf.getID(), consistsOf);
Facet facet = consistsOf.getTarget(); Facet facet = consistsOf.getTarget();
expected.put(facet.getUUID(), facet); expected.put(facet.getID(), facet);
} }
} }
return expected; return expected;
@ -237,7 +237,7 @@ public class MultiContextTest extends ERManagementTest {
String json = resourceManagement.read(); String json = resourceManagement.read();
Resource resource = ElementMapper.unmarshal(r.getClass(), json); Resource resource = ElementMapper.unmarshal(r.getClass(), json);
Assert.assertTrue(resource.getClass() == r.getClass()); Assert.assertTrue(resource.getClass() == r.getClass());
Assert.assertTrue(resource.getUUID().compareTo(r.getUUID())==0); Assert.assertTrue(resource.getID().compareTo(r.getID())==0);
ContextTest.setContextByName(currentContext); ContextTest.setContextByName(currentContext);
} }
} }

View File

@ -162,8 +162,8 @@ public class QueryTest extends ERManagementTest {
HostingNode hostingNode = (HostingNode) map.get(HostingNode.NAME); HostingNode hostingNode = (HostingNode) map.get(HostingNode.NAME);
try { try {
UUID eServiceUUID = eService.getUUID(); UUID eServiceUUID = eService.getID();
UUID hostingNodeUUID = hostingNode.getUUID(); UUID hostingNodeUUID = hostingNode.getID();
ResourceManagement resourceManagement = new ResourceManagement(); ResourceManagement resourceManagement = new ResourceManagement();
resourceManagement.setElementType(Service.NAME); resourceManagement.setElementType(Service.NAME);
@ -174,13 +174,13 @@ public class QueryTest extends ERManagementTest {
List<Resource> resourceList = ElementMapper.unmarshalList(Resource.class, json); List<Resource> resourceList = ElementMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size() == 1); Assert.assertTrue(resourceList.size() == 1);
Resource resource = resourceList.get(0); Resource resource = resourceList.get(0);
Assert.assertTrue(resource.getUUID().compareTo(hostingNodeUUID) == 0); Assert.assertTrue(resource.getID().compareTo(hostingNodeUUID) == 0);
json = resourceManagement.query(IsRelatedTo.NAME, EService.NAME, eServiceUUID, ODirection.OUT, true, null); json = resourceManagement.query(IsRelatedTo.NAME, EService.NAME, eServiceUUID, ODirection.OUT, true, null);
resourceList = ElementMapper.unmarshalList(Resource.class, json); resourceList = ElementMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size() == 1); Assert.assertTrue(resourceList.size() == 1);
resource = resourceList.get(0); resource = resourceList.get(0);
Assert.assertTrue(resource.getUUID().compareTo(hostingNodeUUID) == 0); Assert.assertTrue(resource.getID().compareTo(hostingNodeUUID) == 0);
json = resourceManagement.query(IsRelatedTo.NAME, EService.NAME, eServiceUUID, ODirection.IN, true, null); json = resourceManagement.query(IsRelatedTo.NAME, EService.NAME, eServiceUUID, ODirection.IN, true, null);
resourceList = ElementMapper.unmarshalList(Resource.class, json); resourceList = ElementMapper.unmarshalList(Resource.class, json);
@ -202,7 +202,7 @@ public class QueryTest extends ERManagementTest {
null); null);
resourceList = ElementMapper.unmarshalList(Resource.class, json); resourceList = ElementMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size() == 1); Assert.assertTrue(resourceList.size() == 1);
Assert.assertTrue(resourceList.get(0).getUUID().compareTo(eServiceUUID) == 0); Assert.assertTrue(resourceList.get(0).getID().compareTo(eServiceUUID) == 0);
json = resourceManagement.query(IsRelatedTo.NAME, HostingNode.NAME, hostingNodeUUID, ODirection.OUT, true, null); json = resourceManagement.query(IsRelatedTo.NAME, HostingNode.NAME, hostingNodeUUID, ODirection.OUT, true, null);
resourceList = ElementMapper.unmarshalList(Resource.class, json); resourceList = ElementMapper.unmarshalList(Resource.class, json);
@ -211,7 +211,7 @@ public class QueryTest extends ERManagementTest {
json = resourceManagement.query(IsRelatedTo.NAME, HostingNode.NAME, hostingNodeUUID, ODirection.IN, true, null); json = resourceManagement.query(IsRelatedTo.NAME, HostingNode.NAME, hostingNodeUUID, ODirection.IN, true, null);
resourceList = ElementMapper.unmarshalList(Resource.class, json); resourceList = ElementMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size() == 1); Assert.assertTrue(resourceList.size() == 1);
Assert.assertTrue(resourceList.get(0).getUUID().compareTo(eServiceUUID) == 0); Assert.assertTrue(resourceList.get(0).getID().compareTo(eServiceUUID) == 0);
json = resourceManagement.query(IsRelatedTo.NAME, HostingNode.NAME, hostingNodeUUID, ODirection.BOTH, false, json = resourceManagement.query(IsRelatedTo.NAME, HostingNode.NAME, hostingNodeUUID, ODirection.BOTH, false,
null); null);
@ -229,7 +229,7 @@ public class QueryTest extends ERManagementTest {
/* END Getting HostingNode */ /* END Getting HostingNode */
Facet identificationFacet = eService.getIdentificationFacets().get(0); Facet identificationFacet = eService.getIdentificationFacets().get(0);
UUID identificationFacetUUID = identificationFacet.getUUID(); UUID identificationFacetUUID = identificationFacet.getID();
/* EService --ConsistsOf--> SoftwareFacet */ /* EService --ConsistsOf--> SoftwareFacet */
try { try {
@ -245,8 +245,8 @@ public class QueryTest extends ERManagementTest {
Assert.assertTrue(resourceList.size() == 1); Assert.assertTrue(resourceList.size() == 1);
resource = resourceList.get(0); resource = resourceList.get(0);
Facet targetIdentificationFacet = ((GCubeResource) resource).getIdentificationFacets().get(0); Facet targetIdentificationFacet = ((GCubeResource) resource).getIdentificationFacets().get(0);
Assert.assertTrue(resource.getUUID().compareTo(eServiceUUID) == 0); Assert.assertTrue(resource.getID().compareTo(eServiceUUID) == 0);
Assert.assertTrue(targetIdentificationFacet.getUUID().compareTo(identificationFacetUUID) == 0); Assert.assertTrue(targetIdentificationFacet.getID().compareTo(identificationFacetUUID) == 0);
try { try {
json = resourceManagement.query(ConsistsOf.NAME, SoftwareFacet.NAME, identificationFacetUUID, ODirection.IN, json = resourceManagement.query(ConsistsOf.NAME, SoftwareFacet.NAME, identificationFacetUUID, ODirection.IN,
@ -366,8 +366,8 @@ public class QueryTest extends ERManagementTest {
int expectedSize = 1; int expectedSize = 1;
Set<UUID> expectedUUIDFor2Results = new HashSet<>(); Set<UUID> expectedUUIDFor2Results = new HashSet<>();
expectedUUIDFor2Results.add(createdConfigurations.get(3).getUUID()); expectedUUIDFor2Results.add(createdConfigurations.get(3).getID());
expectedUUIDFor2Results.add(createdConfigurations.get(4).getUUID()); expectedUUIDFor2Results.add(createdConfigurations.get(4).getID());
for(int i=0; i<names.length; i++) { for(int i=0; i<names.length; i++) {
@ -377,7 +377,7 @@ public class QueryTest extends ERManagementTest {
} }
Configuration expected = createdConfigurations.get(i); Configuration expected = createdConfigurations.get(i);
UUID expectedUUID = expected.getUUID(); UUID expectedUUID = expected.getID();
for(Boolean polymorphic : polymorphics) { for(Boolean polymorphic : polymorphics) {
@ -398,12 +398,12 @@ public class QueryTest extends ERManagementTest {
Assert.assertTrue(list.size()==expectedSize); Assert.assertTrue(list.size()==expectedSize);
if(expectedSize==1) { if(expectedSize==1) {
Configuration configuration = list.get(0); Configuration configuration = list.get(0);
UUID gotUUID = configuration.getUUID(); UUID gotUUID = configuration.getID();
Assert.assertTrue(gotUUID.compareTo(expectedUUID)==0); Assert.assertTrue(gotUUID.compareTo(expectedUUID)==0);
}else { }else {
Set<UUID> gotUUIDs = new HashSet<>(); Set<UUID> gotUUIDs = new HashSet<>();
for(Configuration c : list) { for(Configuration c : list) {
gotUUIDs.add(c.getUUID()); gotUUIDs.add(c.getID());
} }
Assert.assertTrue(gotUUIDs.containsAll(expectedUUIDFor2Results)); Assert.assertTrue(gotUUIDs.containsAll(expectedUUIDFor2Results));
@ -425,13 +425,13 @@ public class QueryTest extends ERManagementTest {
if(expectedSize==1) { if(expectedSize==1) {
ConfigurationTemplate configurationTemplate = listPolimorphic.get(0); ConfigurationTemplate configurationTemplate = listPolimorphic.get(0);
Assert.assertTrue(configurationTemplate instanceof Configuration); Assert.assertTrue(configurationTemplate instanceof Configuration);
UUID gotPolimorphicUUID = configurationTemplate.getUUID(); UUID gotPolimorphicUUID = configurationTemplate.getID();
Assert.assertTrue(gotPolimorphicUUID.compareTo(expectedUUID)==0); Assert.assertTrue(gotPolimorphicUUID.compareTo(expectedUUID)==0);
}else { }else {
Set<UUID> gotUUIDs = new HashSet<>(); Set<UUID> gotUUIDs = new HashSet<>();
for(ConfigurationTemplate c : listPolimorphic) { for(ConfigurationTemplate c : listPolimorphic) {
Assert.assertTrue(c instanceof Configuration); Assert.assertTrue(c instanceof Configuration);
gotUUIDs.add(c.getUUID()); gotUUIDs.add(c.getID());
} }
Assert.assertTrue(gotUUIDs.containsAll(expectedUUIDFor2Results)); Assert.assertTrue(gotUUIDs.containsAll(expectedUUIDFor2Results));

View File

@ -38,8 +38,8 @@ public class QueryTemplateManagementTest extends ContextTest {
public static final String GROUP_VARIABLE_NAME = "$group"; public static final String GROUP_VARIABLE_NAME = "$group";
public static void checkUUIDAndMetadata(IdentifiableElement previous, IdentifiableElement got) { public static void checkUUIDAndMetadata(IdentifiableElement previous, IdentifiableElement got) {
Assert.assertTrue(got.getUUID()!= null); Assert.assertTrue(got.getID()!= null);
Assert.assertTrue(got.getUUID().compareTo(previous.getUUID()) == 0); Assert.assertTrue(got.getID().compareTo(previous.getID()) == 0);
Metadata gotMetadata = got.getMetadata(); Metadata gotMetadata = got.getMetadata();
Metadata previousMetadata = previous.getMetadata(); Metadata previousMetadata = previous.getMetadata();

View File

@ -41,10 +41,10 @@ public class FacetManagementTest extends MultiContextTest {
} }
public static void checkUUIDAndMetadata(IdentifiableElement er, UUID uuid, boolean create) { public static void checkUUIDAndMetadata(IdentifiableElement er, UUID uuid, boolean create) {
Assert.assertTrue(er.getUUID() != null); Assert.assertTrue(er.getID() != null);
if(uuid != null) { if(uuid != null) {
Assert.assertTrue(er.getUUID().compareTo(uuid) == 0); Assert.assertTrue(er.getID().compareTo(uuid) == 0);
} }
Assert.assertTrue(er.getMetadata() != null); Assert.assertTrue(er.getMetadata() != null);

View File

@ -30,10 +30,10 @@
"isRelatedTo" : [ "isRelatedTo" : [
{ {
"type": "Activates", "type": "Activates",
"uuid": "d3f58e52-5346-47bc-b736-9d77a0b554ce", "id": "d3f58e52-5346-47bc-b736-9d77a0b554ce",
"source": { "source": {
"type": "HostingNode", "type": "HostingNode",
"uuid" : "5fbc1a56-d450-4f0f-85c1-9b1684581717" "id" : "5fbc1a56-d450-4f0f-85c1-9b1684581717"
} }
} }
] ]

View File

@ -1 +1 @@
TRAVERSE outV("EService") FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("AccessPointFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE outV("EService") FROM ( TRAVERSE inE("IsIdentifiedBy") FROM ( SELECT FROM ( TRAVERSE inV("SoftwareFacet") FROM ( TRAVERSE outE("IsIdentifiedBy") FROM ( TRAVERSE outV("EService") FROM ( SELECT FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE inV("EService") FROM ( TRAVERSE outE("Activates") FROM ( SELECT FROM ( TRAVERSE outV("HostingNode") FROM ( SELECT FROM Activates WHERE uuid = "d3f58e52-5346-47bc-b736-9d77a0b554ce")) WHERE uuid = "5fbc1a56-d450-4f0f-85c1-9b1684581717"))))) WHERE value = "down")) WHERE propagationConstraint.add = "propagate")))) WHERE name = "data-transfer-service" AND group = "DataTransfer"))))) WHERE endpoint = "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service")) TRAVERSE outV("EService") FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("AccessPointFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE outV("EService") FROM ( TRAVERSE inE("IsIdentifiedBy") FROM ( SELECT FROM ( TRAVERSE inV("SoftwareFacet") FROM ( TRAVERSE outE("IsIdentifiedBy") FROM ( TRAVERSE outV("EService") FROM ( SELECT FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE inV("EService") FROM ( TRAVERSE outE("Activates") FROM ( SELECT FROM ( TRAVERSE outV("HostingNode") FROM ( SELECT FROM Activates WHERE id = "d3f58e52-5346-47bc-b736-9d77a0b554ce")) WHERE id = "5fbc1a56-d450-4f0f-85c1-9b1684581717"))))) WHERE value = "down")) WHERE propagationConstraint.add = "propagate")))) WHERE name = "data-transfer-service" AND group = "DataTransfer"))))) WHERE endpoint = "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"))

View File

@ -5,7 +5,7 @@
"type": "ConsistsOf", "type": "ConsistsOf",
"source" : { "source" : {
"type" : "EService", "type" : "EService",
"uuid": "0255b7ec-e3da-4071-b456-9a2907ece1db" "id": "0255b7ec-e3da-4071-b456-9a2907ece1db"
} }
} }
} }

View File

@ -1 +1 @@
SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM EService WHERE uuid = "0255b7ec-e3da-4071-b456-9a2907ece1db"))) WHERE value = "down" SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM EService WHERE id = "0255b7ec-e3da-4071-b456-9a2907ece1db"))) WHERE value = "down"

View File

@ -7,11 +7,11 @@
"type" : "EService", "type" : "EService",
"$or": [ "$or": [
{"$and": { {"$and": {
"uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925", "id" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925",
"metadata" :{ "createdBy": {"$ne": "luca.frosini"} } "metadata" :{ "createdBy": {"$ne": "luca.frosini"} }
}}, }},
{"$and": { {"$and": {
"uuid" : "0255b7ec-e3da-4071-b456-9a2907ece1db", "id" : "0255b7ec-e3da-4071-b456-9a2907ece1db",
"metadata" : { "createdBy": "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080" } "metadata" : { "createdBy": "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080" }
}} }}
] ]

View File

@ -1 +1 @@
SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM EService WHERE ((uuid = "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925" AND metadata.createdBy <> "luca.frosini") OR (uuid = "0255b7ec-e3da-4071-b456-9a2907ece1db" AND metadata.createdBy = "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080"))))) WHERE value = "down" SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM EService WHERE ((id = "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925" AND metadata.createdBy <> "luca.frosini") OR (id = "0255b7ec-e3da-4071-b456-9a2907ece1db" AND metadata.createdBy = "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080"))))) WHERE value = "down"

View File

@ -1,6 +1,6 @@
{ {
"type": "EService", "type": "EService",
"uuid": "0255b7ec-e3da-4071-b456-9a2907ece1db", "id": "0255b7ec-e3da-4071-b456-9a2907ece1db",
"consistsOf": [ "consistsOf": [
{ {
"type": "ConsistsOf", "type": "ConsistsOf",
@ -31,10 +31,10 @@
"isRelatedTo" : [ "isRelatedTo" : [
{ {
"type": "Activates", "type": "Activates",
"uuid": "d3f58e52-5346-47bc-b736-9d77a0b554ce", "id": "d3f58e52-5346-47bc-b736-9d77a0b554ce",
"source": { "source": {
"type": "HostingNode", "type": "HostingNode",
"uuid" : "5fbc1a56-d450-4f0f-85c1-9b1684581717", "id" : "5fbc1a56-d450-4f0f-85c1-9b1684581717",
"consistsOf": [ "consistsOf": [
{ {
"type": "ConsistsOf", "type": "ConsistsOf",

View File

@ -1 +1 @@
SELECT FROM ( TRAVERSE outV("EService") FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("AccessPointFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE outV("EService") FROM ( TRAVERSE inE("IsIdentifiedBy") FROM ( SELECT FROM ( TRAVERSE inV("SoftwareFacet") FROM ( TRAVERSE outE("IsIdentifiedBy") FROM ( TRAVERSE outV("EService") FROM ( SELECT FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE inV("EService") FROM ( TRAVERSE outE("Activates") FROM ( SELECT FROM ( TRAVERSE outV("HostingNode") FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("CPUFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE outV("HostingNode") FROM ( SELECT FROM Activates WHERE uuid = "d3f58e52-5346-47bc-b736-9d77a0b554ce")))) WHERE vendor = "GenuineIntel"))) WHERE uuid = "5fbc1a56-d450-4f0f-85c1-9b1684581717"))))) WHERE value = "down")) WHERE propagationConstraint.add = "propagate")))) WHERE name = "data-transfer-service" AND group = "DataTransfer"))))) WHERE endpoint = "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"))) WHERE uuid = "0255b7ec-e3da-4071-b456-9a2907ece1db" SELECT FROM ( TRAVERSE outV("EService") FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("AccessPointFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE outV("EService") FROM ( TRAVERSE inE("IsIdentifiedBy") FROM ( SELECT FROM ( TRAVERSE inV("SoftwareFacet") FROM ( TRAVERSE outE("IsIdentifiedBy") FROM ( TRAVERSE outV("EService") FROM ( SELECT FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE inV("EService") FROM ( TRAVERSE outE("Activates") FROM ( SELECT FROM ( TRAVERSE outV("HostingNode") FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("CPUFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE outV("HostingNode") FROM ( SELECT FROM Activates WHERE id = "d3f58e52-5346-47bc-b736-9d77a0b554ce")))) WHERE vendor = "GenuineIntel"))) WHERE id = "5fbc1a56-d450-4f0f-85c1-9b1684581717"))))) WHERE value = "down")) WHERE propagationConstraint.add = "propagate")))) WHERE name = "data-transfer-service" AND group = "DataTransfer"))))) WHERE endpoint = "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"))) WHERE id = "0255b7ec-e3da-4071-b456-9a2907ece1db"

View File

@ -6,11 +6,11 @@
"type" : "EService", "type" : "EService",
"$or": [ "$or": [
{"$and": { {"$and": {
"uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925", "id" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925",
"metadata" :{ "createdBy": {"$ne": "luca.frosini"} } "metadata" :{ "createdBy": {"$ne": "luca.frosini"} }
}}, }},
{"$and": { {"$and": {
"uuid" : "0255b7ec-e3da-4071-b456-9a2907ece1db", "id" : "0255b7ec-e3da-4071-b456-9a2907ece1db",
"metadata" : { "createdBy": "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080" } "metadata" : { "createdBy": "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080" }
}} }}
] ]

View File

@ -1 +1 @@
SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM EService WHERE ((uuid = "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925" AND metadata.createdBy <> "luca.frosini") OR (uuid = "0255b7ec-e3da-4071-b456-9a2907ece1db" AND metadata.createdBy = "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080"))))) SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM EService WHERE ((id = "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925" AND metadata.createdBy <> "luca.frosini") OR (id = "0255b7ec-e3da-4071-b456-9a2907ece1db" AND metadata.createdBy = "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080")))))