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:
parent
6e984b7acb
commit
f57e55f9a4
|
@ -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();
|
||||||
|
@ -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);
|
||||||
|
@ -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 */
|
||||||
|
@ -633,8 +627,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);
|
||||||
|
|
||||||
PropagationConstraint propagationConstraint = new PropagationConstraintImpl();
|
PropagationConstraint propagationConstraint = new PropagationConstraintImpl();
|
||||||
|
|
Loading…
Reference in New Issue