Refs #11903: Use new REST interface in Resource Registry Publisher

Task-Url: https://support.d4science.org/issues/11903

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-publisher@169036 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2018-06-12 08:02:31 +00:00
parent 6e984b7acb
commit f57e55f9a4
1 changed files with 214 additions and 220 deletions

View File

@ -77,8 +77,8 @@ public class ERManagementTest extends ScopedTest {
softwareFacet.setGroup("InformationSystem"); softwareFacet.setGroup("InformationSystem");
softwareFacet.setName("resource-registry"); softwareFacet.setName("resource-registry");
softwareFacet.setVersion("1.1.0"); softwareFacet.setVersion("1.1.0");
IsIdentifiedBy<EService, Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService, Facet>(eService, IsIdentifiedBy<EService,Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService,Facet>(eService, softwareFacet,
softwareFacet, null); null);
eService.addFacet(isIdentifiedBy); eService.addFacet(isIdentifiedBy);
AccessPointFacet accessPointFacet = new AccessPointFacetImpl(); AccessPointFacet accessPointFacet = new AccessPointFacetImpl();
@ -115,8 +115,8 @@ public class ERManagementTest extends ScopedTest {
softwareFacet.setGroup("InformationSystem"); softwareFacet.setGroup("InformationSystem");
softwareFacet.setName("resource-registry"); softwareFacet.setName("resource-registry");
softwareFacet.setVersion("1.1.0"); softwareFacet.setVersion("1.1.0");
IsIdentifiedBy<EService, Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService, Facet>(eService, IsIdentifiedBy<EService,Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService,Facet>(eService, softwareFacet,
softwareFacet, null); null);
eService.addFacet(isIdentifiedBy); eService.addFacet(isIdentifiedBy);
AccessPointFacet accessPointFacet = new AccessPointFacetImpl(); AccessPointFacet accessPointFacet = new AccessPointFacetImpl();
@ -159,8 +159,8 @@ public class ERManagementTest extends ScopedTest {
softwareFacet.setGroup("InformationSystem"); softwareFacet.setGroup("InformationSystem");
softwareFacet.setName("resource-registry"); softwareFacet.setName("resource-registry");
softwareFacet.setVersion("1.1.0"); softwareFacet.setVersion("1.1.0");
IsIdentifiedBy<EService, Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService, Facet>(eService, IsIdentifiedBy<EService,Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService,Facet>(eService, softwareFacet,
softwareFacet, null); null);
eService.addFacet(isIdentifiedBy); eService.addFacet(isIdentifiedBy);
AccessPointFacet accessPointFacet = new AccessPointFacetImpl(); AccessPointFacet accessPointFacet = new AccessPointFacetImpl();
@ -201,8 +201,8 @@ public class ERManagementTest extends ScopedTest {
softwareFacet.setGroup("InformationSystem"); softwareFacet.setGroup("InformationSystem");
softwareFacet.setName("resource-registry"); softwareFacet.setName("resource-registry");
softwareFacet.setVersion("1.1.0"); softwareFacet.setVersion("1.1.0");
IsIdentifiedBy<EService, Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService, Facet>(eService, IsIdentifiedBy<EService,Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService,Facet>(eService, softwareFacet,
softwareFacet, null); null);
eService.addFacet(isIdentifiedBy); eService.addFacet(isIdentifiedBy);
AccessPointFacet accessPointFacet = new AccessPointFacetImpl(); AccessPointFacet accessPointFacet = new AccessPointFacetImpl();
@ -289,8 +289,8 @@ public class ERManagementTest extends ScopedTest {
Assert.assertTrue(deleted); Assert.assertTrue(deleted);
} }
public Map<String, Resource> createHostingNodeAndEService() throws Exception { public Map<String,Resource> createHostingNodeAndEService() throws Exception {
Map<String, Resource> map = new HashMap<>(); Map<String,Resource> map = new HashMap<>();
EService eService = new EServiceImpl(); EService eService = new EServiceImpl();
@ -299,8 +299,8 @@ public class ERManagementTest extends ScopedTest {
softwareFacet.setName("resource-registry"); softwareFacet.setName("resource-registry");
softwareFacet.setVersion("1.1.0"); softwareFacet.setVersion("1.1.0");
IsIdentifiedBy<Resource, Facet> isIdentifiedBy = new IsIdentifiedByImpl<Resource, Facet>(eService, IsIdentifiedBy<Resource,Facet> isIdentifiedBy = new IsIdentifiedByImpl<Resource,Facet>(eService, softwareFacet,
softwareFacet, null); null);
eService.addFacet(isIdentifiedBy); eService.addFacet(isIdentifiedBy);
eService = resourceRegistryPublisher.createResource(eService); eService = resourceRegistryPublisher.createResource(eService);
@ -324,14 +324,14 @@ public class ERManagementTest extends ScopedTest {
cpuFacet.setVendor("AMD"); cpuFacet.setVendor("AMD");
hostingNode.addFacet(cpuFacet); hostingNode.addFacet(cpuFacet);
isIdentifiedBy = new IsIdentifiedByImpl<Resource, Facet>(hostingNode, networkingFacet, null); isIdentifiedBy = new IsIdentifiedByImpl<Resource,Facet>(hostingNode, networkingFacet, null);
hostingNode.addFacet(isIdentifiedBy); hostingNode.addFacet(isIdentifiedBy);
PropagationConstraint propagationConstraint = new PropagationConstraintImpl(); PropagationConstraint propagationConstraint = new PropagationConstraintImpl();
propagationConstraint.setRemoveConstraint(RemoveConstraint.cascade); propagationConstraint.setRemoveConstraint(RemoveConstraint.cascade);
propagationConstraint.setAddConstraint(AddConstraint.unpropagate); propagationConstraint.setAddConstraint(AddConstraint.unpropagate);
Hosts<HostingNode, EService> hosts = new HostsImpl<HostingNode, EService>(hostingNode, eService, Hosts<HostingNode,EService> hosts = new HostsImpl<HostingNode,EService>(hostingNode, eService,
propagationConstraint); propagationConstraint);
hostingNode.attachResource(hosts); hostingNode.attachResource(hosts);
@ -344,7 +344,7 @@ public class ERManagementTest extends ScopedTest {
@Test @Test
public void testCreateHostingNodeAndEService() throws Exception { public void testCreateHostingNodeAndEService() throws Exception {
Map<String, Resource> map = createHostingNodeAndEService(); Map<String,Resource> map = createHostingNodeAndEService();
boolean deleted = resourceRegistryPublisher.deleteResource(map.get(EService.NAME)); boolean deleted = resourceRegistryPublisher.deleteResource(map.get(EService.NAME));
Assert.assertTrue(deleted); Assert.assertTrue(deleted);
@ -355,7 +355,7 @@ public class ERManagementTest extends ScopedTest {
@Test @Test
public void testCreateHostingNodeAndEServiceWithSharedFacet() throws Exception { public void testCreateHostingNodeAndEServiceWithSharedFacet() throws Exception {
Map<String, Resource> map = createHostingNodeAndEService(); Map<String,Resource> map = createHostingNodeAndEService();
EService eService = (EService) map.get(EService.NAME); EService eService = (EService) map.get(EService.NAME);
HostingNode hostingNode = (HostingNode) map.get(HostingNode.NAME); HostingNode hostingNode = (HostingNode) map.get(HostingNode.NAME);
@ -363,7 +363,7 @@ public class ERManagementTest extends ScopedTest {
Facet shared = hostingNode.getConsistsOf().get(0).getTarget(); Facet shared = hostingNode.getConsistsOf().get(0).getTarget();
UUID sharedFacetUUID = shared.getHeader().getUUID(); UUID sharedFacetUUID = shared.getHeader().getUUID();
ConsistsOf<EService, Facet> consistsOf = new ConsistsOfImpl<EService, Facet>(eService, shared, null); ConsistsOf<EService,Facet> consistsOf = new ConsistsOfImpl<EService,Facet>(eService, shared, null);
consistsOf = resourceRegistryPublisher.createConsistsOf(consistsOf); consistsOf = resourceRegistryPublisher.createConsistsOf(consistsOf);
boolean deleted = resourceRegistryPublisher.deleteResource(map.get(EService.NAME)); boolean deleted = resourceRegistryPublisher.deleteResource(map.get(EService.NAME));
@ -375,7 +375,7 @@ public class ERManagementTest extends ScopedTest {
try { try {
resourceRegistryClient.getInstance(Facet.class, sharedFacetUUID); resourceRegistryClient.getInstance(Facet.class, sharedFacetUUID);
throw new Exception(String.format("Shared Facet %s was not deleted", shared)); throw new Exception(String.format("Shared Facet %s was not deleted", shared));
} catch (ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.debug("Shared Facet was not foud as expected"); logger.debug("Shared Facet was not foud as expected");
} }
} }
@ -393,7 +393,7 @@ public class ERManagementTest extends ScopedTest {
CPUFacet createdCpuFacet = resourceRegistryPublisher.createFacet(cpuFacet); CPUFacet createdCpuFacet = resourceRegistryPublisher.createFacet(cpuFacet);
ConsistsOf<HostingNode, Facet> consistsOf = new ConsistsOfImpl<HostingNode, Facet>(hostingNode, createdCpuFacet, ConsistsOf<HostingNode,Facet> consistsOf = new ConsistsOfImpl<HostingNode,Facet>(hostingNode, createdCpuFacet,
null); null);
consistsOf = resourceRegistryPublisher.createConsistsOf(consistsOf); consistsOf = resourceRegistryPublisher.createConsistsOf(consistsOf);
@ -401,7 +401,7 @@ public class ERManagementTest extends ScopedTest {
boolean detached = resourceRegistryPublisher.deleteConsistsOf(consistsOf); boolean detached = resourceRegistryPublisher.deleteConsistsOf(consistsOf);
if (detached) { if(detached) {
logger.trace("{} {} with uuid {} removed successfully", ConsistsOf.NAME, Relation.NAME, consistOfUUID); logger.trace("{} {} with uuid {} removed successfully", ConsistsOf.NAME, Relation.NAME, consistOfUUID);
} else { } else {
String error = String.format("Unable to remove %s %s with uuid %s", ConsistsOf.NAME, Relation.NAME, String error = String.format("Unable to remove %s %s with uuid %s", ConsistsOf.NAME, Relation.NAME,
@ -417,18 +417,18 @@ public class ERManagementTest extends ScopedTest {
@Test @Test
public void testGetAll() throws Exception { public void testGetAll() throws Exception {
Map<String, List<Resource>> resources = new HashMap<>(); Map<String,List<Resource>> resources = new HashMap<>();
final int MAX = 5; final int MAX = 5;
int typeNumber = 0; int typeNumber = 0;
for (int i = 0; i < MAX; i++) { for(int i = 0; i < MAX; i++) {
Map<String, Resource> map = createHostingNodeAndEService(); Map<String,Resource> map = createHostingNodeAndEService();
if (typeNumber == 0) { if(typeNumber == 0) {
typeNumber = map.size(); typeNumber = map.size();
} }
for (String key : map.keySet()) { for(String key : map.keySet()) {
if (!resources.containsKey(key)) { if(!resources.containsKey(key)) {
resources.put(key, new ArrayList<Resource>()); resources.put(key, new ArrayList<Resource>());
} }
resources.get(key).add(map.get(key)); resources.get(key).add(map.get(key));
@ -436,7 +436,7 @@ public class ERManagementTest extends ScopedTest {
} }
/* Getting all instances of created specific Resources */ /* Getting all instances of created specific Resources */
for (String key : resources.keySet()) { for(String key : resources.keySet()) {
String instances = resourceRegistryClient.getInstances(key, false); String instances = resourceRegistryClient.getInstances(key, false);
List<Resource> list = ISMapper.unmarshalList(Resource.class, instances); List<Resource> list = ISMapper.unmarshalList(Resource.class, instances);
logger.debug("{} are {} : {} ", key, list.size(), list); logger.debug("{} are {} : {} ", key, list.size(), list);
@ -474,7 +474,7 @@ public class ERManagementTest extends ScopedTest {
/* Removing created Entity and Relation to have a clean DB */ /* Removing created Entity and Relation to have a clean DB */
List<Resource> resourceList = resources.get(HostingNode.NAME); List<Resource> resourceList = resources.get(HostingNode.NAME);
for (Resource r : resourceList) { for(Resource r : resourceList) {
boolean deleted = resourceRegistryPublisher.deleteResource(r); boolean deleted = resourceRegistryPublisher.deleteResource(r);
Assert.assertTrue(deleted); Assert.assertTrue(deleted);
} }
@ -482,7 +482,7 @@ public class ERManagementTest extends ScopedTest {
@Test @Test
public void testGetAllFrom() throws Exception { public void testGetAllFrom() throws Exception {
Map<String, Resource> map = createHostingNodeAndEService(); Map<String,Resource> map = createHostingNodeAndEService();
EService eService = (EService) map.get(EService.NAME); EService eService = (EService) map.get(EService.NAME);
UUID eServiceUUID = eService.getHeader().getUUID(); UUID eServiceUUID = eService.getHeader().getUUID();
@ -491,108 +491,102 @@ public class ERManagementTest extends ScopedTest {
UUID hostingNodeUUID = hostingNode.getHeader().getUUID(); UUID hostingNodeUUID = hostingNode.getHeader().getUUID();
/* EService */ /* EService */
List<Resource> resourceList = resourceRegistryClient.getInstancesFromEntity(IsRelatedTo.class, true, List<Resource> resourceList = resourceRegistryClient.getRelatedResourcesFromReferenceResource(Resource.class,
eServiceUUID, Direction.both); IsRelatedTo.class, EService.class, eServiceUUID, Direction.both, true);
Assert.assertTrue(resourceList.size() == 1); Assert.assertTrue(resourceList.size() == 1);
Resource sourceResource = resourceList.get(0); Resource sourceResource = resourceList.get(0);
Resource targetResource = sourceResource.getIsRelatedTo().get(0).getTarget(); Resource targetResource = sourceResource.getIsRelatedTo().get(0).getTarget();
Assert.assertTrue(sourceResource.getHeader().getUUID().compareTo(hostingNodeUUID) == 0); Assert.assertTrue(sourceResource.getHeader().getUUID().compareTo(hostingNodeUUID) == 0);
Assert.assertTrue(targetResource.getHeader().getUUID().compareTo(eServiceUUID) == 0); Assert.assertTrue(targetResource.getHeader().getUUID().compareTo(eServiceUUID) == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(IsRelatedTo.class, true, eServiceUUID, resourceList = resourceRegistryClient.getRelatedResourcesFromReferenceResource(Resource.class,
Direction.in); IsRelatedTo.class, EService.class, eServiceUUID, Direction.out, true);
Assert.assertTrue(resourceList.size() == 1); Assert.assertTrue(resourceList.size() == 1);
sourceResource = resourceList.get(0); sourceResource = resourceList.get(0);
targetResource = sourceResource.getIsRelatedTo().get(0).getTarget(); targetResource = sourceResource.getIsRelatedTo().get(0).getTarget();
Assert.assertTrue(sourceResource.getHeader().getUUID().compareTo(hostingNodeUUID) == 0); Assert.assertTrue(sourceResource.getHeader().getUUID().compareTo(hostingNodeUUID) == 0);
Assert.assertTrue(targetResource.getHeader().getUUID().compareTo(eServiceUUID) == 0); Assert.assertTrue(targetResource.getHeader().getUUID().compareTo(eServiceUUID) == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(IsRelatedTo.class, true, eServiceUUID, resourceList = resourceRegistryClient.getRelatedResourcesFromReferenceResource(Resource.class,
Direction.out); IsRelatedTo.class, EService.class, eServiceUUID, Direction.in, true);
Assert.assertTrue(resourceList.size() == 0); Assert.assertTrue(resourceList.size() == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(IsRelatedTo.class, false, eServiceUUID, resourceList = resourceRegistryClient.getRelatedResourcesFromReferenceResource(Resource.class,
Direction.both); IsRelatedTo.class, EService.class, eServiceUUID, Direction.both, false);
Assert.assertTrue(resourceList.size() == 0); Assert.assertTrue(resourceList.size() == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(IsRelatedTo.class, false, eServiceUUID, resourceList = resourceRegistryClient.getRelatedResourcesFromReferenceResource(Resource.class,
Direction.in); IsRelatedTo.class, EService.class, eServiceUUID, Direction.out, false);
Assert.assertTrue(resourceList.size() == 0); Assert.assertTrue(resourceList.size() == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(IsRelatedTo.class, false, eServiceUUID, resourceList = resourceRegistryClient.getRelatedResourcesFromReferenceResource(Resource.class,
Direction.out); IsRelatedTo.class, EService.class, eServiceUUID, Direction.in, false);
Assert.assertTrue(resourceList.size() == 0); Assert.assertTrue(resourceList.size() == 0);
/* END EService */ /* END EService */
/* Hosting Node */ /* Hosting Node */
resourceList = resourceRegistryClient.getInstancesFromEntity(IsRelatedTo.class, true, hostingNodeUUID, resourceList = resourceRegistryClient.getRelatedResourcesFromReferenceResource(Resource.class,
Direction.both); IsRelatedTo.class, HostingNode.class, hostingNodeUUID, Direction.both, true);
Assert.assertTrue(resourceList.size() == 1); Assert.assertTrue(resourceList.size() == 1);
sourceResource = resourceList.get(0); sourceResource = resourceList.get(0);
targetResource = sourceResource.getIsRelatedTo().get(0).getTarget(); targetResource = sourceResource.getIsRelatedTo().get(0).getTarget();
Assert.assertTrue(sourceResource.getHeader().getUUID().compareTo(hostingNodeUUID) == 0); Assert.assertTrue(sourceResource.getHeader().getUUID().compareTo(hostingNodeUUID) == 0);
Assert.assertTrue(targetResource.getHeader().getUUID().compareTo(eServiceUUID) == 0); Assert.assertTrue(targetResource.getHeader().getUUID().compareTo(eServiceUUID) == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(IsRelatedTo.class, true, hostingNodeUUID, resourceList = resourceRegistryClient.getRelatedResourcesFromReferenceResource(Resource.class,
Direction.in); IsRelatedTo.class, HostingNode.class, hostingNodeUUID, Direction.out, true);
Assert.assertTrue(resourceList.size() == 0); Assert.assertTrue(resourceList.size() == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(IsRelatedTo.class, true, hostingNodeUUID, resourceList = resourceRegistryClient.getRelatedResourcesFromReferenceResource(Resource.class,
Direction.out); IsRelatedTo.class, HostingNode.class, hostingNodeUUID, Direction.in, true);
Assert.assertTrue(resourceList.size() == 1); Assert.assertTrue(resourceList.size() == 1);
sourceResource = resourceList.get(0); sourceResource = resourceList.get(0);
targetResource = sourceResource.getIsRelatedTo().get(0).getTarget(); targetResource = sourceResource.getIsRelatedTo().get(0).getTarget();
Assert.assertTrue(sourceResource.getHeader().getUUID().compareTo(hostingNodeUUID) == 0); Assert.assertTrue(sourceResource.getHeader().getUUID().compareTo(hostingNodeUUID) == 0);
Assert.assertTrue(targetResource.getHeader().getUUID().compareTo(eServiceUUID) == 0); Assert.assertTrue(targetResource.getHeader().getUUID().compareTo(eServiceUUID) == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(IsRelatedTo.class, false, hostingNodeUUID, resourceList = resourceRegistryClient.getRelatedResourcesFromReferenceResource(Resource.class,
Direction.both); IsRelatedTo.class, HostingNode.class, hostingNodeUUID, Direction.both, false);
Assert.assertTrue(resourceList.size() == 0); Assert.assertTrue(resourceList.size() == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(IsRelatedTo.class, false, hostingNodeUUID, resourceList = resourceRegistryClient.getRelatedResourcesFromReferenceResource(Resource.class,
Direction.in); IsRelatedTo.class, HostingNode.class, hostingNodeUUID, Direction.out, false);
Assert.assertTrue(resourceList.size() == 0); Assert.assertTrue(resourceList.size() == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(IsRelatedTo.class, false, hostingNodeUUID, resourceList = resourceRegistryClient.getRelatedResourcesFromReferenceResource(Resource.class,
Direction.out); IsRelatedTo.class, HostingNode.class, hostingNodeUUID, Direction.in, false);
Assert.assertTrue(resourceList.size() == 0); Assert.assertTrue(resourceList.size() == 0);
/* END HostingNode */ /* END HostingNode */
Facet identificationFacet = eService.getIdentificationFacets().get(0); Facet identificationFacet = eService.getIdentificationFacets().get(0);
UUID identificationFacetUUID = identificationFacet.getHeader().getUUID(); UUID identificationFacetUUID = identificationFacet.getHeader().getUUID();
/* SoftwareFacet of Eservice */
resourceList = resourceRegistryClient.getInstancesFromEntity(ConsistsOf.class, true, identificationFacetUUID,
Direction.both); /* Eservice with Software Facet as Identification Facet */
resourceList = resourceRegistryClient.getResourcesFromReferenceFacet(Resource.class, ConsistsOf.class, SoftwareFacet.class, identificationFacetUUID, true);
Assert.assertTrue(resourceList.size() == 1); Assert.assertTrue(resourceList.size() == 1);
sourceResource = resourceList.get(0); sourceResource = resourceList.get(0);
Facet targetIdentificationFacet = sourceResource.getIdentificationFacets().get(0); Facet targetIdentificationFacet = sourceResource.getIdentificationFacets().get(0);
Assert.assertTrue(sourceResource.getHeader().getUUID().compareTo(eServiceUUID) == 0); Assert.assertTrue(sourceResource.getHeader().getUUID().compareTo(eServiceUUID) == 0);
Assert.assertTrue(targetIdentificationFacet.getHeader().getUUID().compareTo(identificationFacetUUID) == 0); Assert.assertTrue(targetIdentificationFacet.getHeader().getUUID().compareTo(identificationFacetUUID) == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(ConsistsOf.class, true, identificationFacetUUID, resourceList = resourceRegistryClient.getResourcesFromReferenceFacet(Resource.class, ConsistsOf.class, SoftwareFacet.class, identificationFacetUUID, false);
Direction.in); Assert.assertTrue(resourceList.size() == 0);
/* END Eservice with Software Facet as Identification Facet */
/* END SoftwareFacet of Eservice */
List<Facet> facets = resourceRegistryClient.getRelated(Facet.class, ConsistsOf.class, EService.class, eServiceUUID, Direction.in, true);
Assert.assertTrue(resourceList.size() == 1); Assert.assertTrue(resourceList.size() == 1);
sourceResource = resourceList.get(0); Facet facet = facets.get(0);
targetIdentificationFacet = sourceResource.getIdentificationFacets().get(0); Assert.assertTrue(facet.getHeader().getUUID().compareTo(identificationFacetUUID) == 0);
Assert.assertTrue(sourceResource.getHeader().getUUID().compareTo(eServiceUUID) == 0);
Assert.assertTrue(targetIdentificationFacet.getHeader().getUUID().compareTo(identificationFacetUUID) == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(ConsistsOf.class, true, identificationFacetUUID, facets = resourceRegistryClient.getRelated(Facet.class, ConsistsOf.class, EService.class, eServiceUUID, Direction.in, false);
Direction.out);
Assert.assertTrue(resourceList.size() == 0); Assert.assertTrue(resourceList.size() == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(ConsistsOf.class, false, identificationFacetUUID,
Direction.both);
Assert.assertTrue(resourceList.size() == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(ConsistsOf.class, false, identificationFacetUUID,
Direction.in);
Assert.assertTrue(resourceList.size() == 0);
resourceList = resourceRegistryClient.getInstancesFromEntity(ConsistsOf.class, false, identificationFacetUUID,
Direction.out);
Assert.assertTrue(resourceList.size() == 0);
/* END SoftwareFacet of Eservice */ /* END SoftwareFacet of Eservice */
/* Removing created Entity and Relation to have a clean DB */ /* Removing created Entity and Relation to have a clean DB */
@ -618,7 +612,7 @@ public class ERManagementTest extends ScopedTest {
networkingFacet.setMask("255.255.248.0"); networkingFacet.setMask("255.255.248.0");
networkingFacet.setBroadcastAddress("146.48.87.255"); networkingFacet.setBroadcastAddress("146.48.87.255");
IsIdentifiedBy<HostingNode, NetworkingFacet> hnIsIdentifiedBy = new IsIdentifiedByImpl<HostingNode, NetworkingFacet>( IsIdentifiedBy<HostingNode,NetworkingFacet> hnIsIdentifiedBy = new IsIdentifiedByImpl<HostingNode,NetworkingFacet>(
hostingNode, networkingFacet, null); hostingNode, networkingFacet, null);
hostingNode.addFacet(hnIsIdentifiedBy); hostingNode.addFacet(hnIsIdentifiedBy);
@ -633,15 +627,15 @@ public class ERManagementTest extends ScopedTest {
softwareFacet.setName("resource-registry"); softwareFacet.setName("resource-registry");
softwareFacet.setVersion("1.1.0"); softwareFacet.setVersion("1.1.0");
IsIdentifiedBy<Resource, Facet> isIdentifiedBy = new IsIdentifiedByImpl<Resource, Facet>(eService, IsIdentifiedBy<Resource,Facet> isIdentifiedBy = new IsIdentifiedByImpl<Resource,Facet>(eService, softwareFacet,
softwareFacet, null); null);
eService.addFacet(isIdentifiedBy); eService.addFacet(isIdentifiedBy);
PropagationConstraint propagationConstraint = new PropagationConstraintImpl(); PropagationConstraint propagationConstraint = new PropagationConstraintImpl();
propagationConstraint.setRemoveConstraint(RemoveConstraint.cascade); propagationConstraint.setRemoveConstraint(RemoveConstraint.cascade);
propagationConstraint.setAddConstraint(AddConstraint.unpropagate); propagationConstraint.setAddConstraint(AddConstraint.unpropagate);
Hosts<HostingNode, EService> hosts = new HostsImpl<HostingNode, EService>(hostingNode, eService, Hosts<HostingNode,EService> hosts = new HostsImpl<HostingNode,EService>(hostingNode, eService,
propagationConstraint); propagationConstraint);
hosts = resourceRegistryPublisher.createIsRelatedTo(hosts); hosts = resourceRegistryPublisher.createIsRelatedTo(hosts);