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@169034 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9eb3aba0ae
commit
6e984b7acb
|
@ -2,10 +2,13 @@ package org.gcube.informationsystem.resourceregistry.publisher;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.gcube.informationsystem.model.ER;
|
||||||
import org.gcube.informationsystem.model.entity.Facet;
|
import org.gcube.informationsystem.model.entity.Facet;
|
||||||
import org.gcube.informationsystem.model.entity.Resource;
|
import org.gcube.informationsystem.model.entity.Resource;
|
||||||
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
||||||
import org.gcube.informationsystem.model.relation.IsRelatedTo;
|
import org.gcube.informationsystem.model.relation.IsRelatedTo;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetAlreadyPresentException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetAlreadyPresentException;
|
||||||
|
@ -18,10 +21,36 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resour
|
||||||
*/
|
*/
|
||||||
public interface ResourceRegistryPublisher {
|
public interface ResourceRegistryPublisher {
|
||||||
|
|
||||||
@Deprecated
|
public <E extends ER> E create(E er)
|
||||||
public <F extends Facet> F createFacet(Class<F> facetClass, F facet)
|
throws AlreadyPresentException, ResourceRegistryException;
|
||||||
throws FacetAlreadyPresentException, ResourceRegistryException;
|
|
||||||
|
public String create(String erType, String er)
|
||||||
|
throws AlreadyPresentException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public String create(String er) throws AlreadyPresentException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
|
public <E extends ER> E read(E er) throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public String read(String erType, UUID uuid) throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
|
public <E extends ER> E update(E er)
|
||||||
|
throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public String update(String erType, String er) throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public String update(String er) throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
|
public <E extends ER> boolean delete(E er) throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public boolean delete(String erType, UUID uuid) throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
|
/* ----- */
|
||||||
|
|
||||||
|
|
||||||
public <F extends Facet> F createFacet(F facet)
|
public <F extends Facet> F createFacet(F facet)
|
||||||
throws FacetAlreadyPresentException, ResourceRegistryException;
|
throws FacetAlreadyPresentException, ResourceRegistryException;
|
||||||
|
|
||||||
|
@ -29,26 +58,27 @@ public interface ResourceRegistryPublisher {
|
||||||
throws FacetAlreadyPresentException, ResourceRegistryException;
|
throws FacetAlreadyPresentException, ResourceRegistryException;
|
||||||
|
|
||||||
public String createFacet(String facet) throws FacetAlreadyPresentException, ResourceRegistryException;
|
public String createFacet(String facet) throws FacetAlreadyPresentException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
|
public <F extends Facet> F readFacet(F facet) throws FacetNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
@Deprecated
|
public String readFacet(String facetType, UUID uuid) throws FacetNotFoundException, ResourceRegistryException;
|
||||||
public <F extends Facet> F updateFacet(Class<F> facetClass, F facet)
|
|
||||||
throws FacetNotFoundException, ResourceRegistryException;
|
|
||||||
|
|
||||||
public <F extends Facet> F updateFacet(F facet)
|
public <F extends Facet> F updateFacet(F facet)
|
||||||
throws FacetNotFoundException, ResourceRegistryException;
|
throws FacetNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public String updateFacet(UUID uuid, String facet) throws FacetNotFoundException, ResourceRegistryException;
|
|
||||||
|
|
||||||
public String updateFacet(String facet) throws FacetNotFoundException, ResourceRegistryException;
|
public String updateFacet(String facet) throws FacetNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
public <F extends Facet> boolean deleteFacet(F facet) throws FacetNotFoundException, ResourceRegistryException;
|
public <F extends Facet> boolean deleteFacet(F facet) throws FacetNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public boolean deleteFacet(UUID uuid) throws FacetNotFoundException, ResourceRegistryException;
|
public boolean deleteFacet(String facetType, UUID uuid) throws FacetNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public <R extends Resource> R createResource(Class<R> resourceClass, R resource)
|
|
||||||
throws ResourceAlreadyPresentException, ResourceRegistryException;
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ----- */
|
||||||
|
|
||||||
|
|
||||||
public <R extends Resource> R createResource(R resource)
|
public <R extends Resource> R createResource(R resource)
|
||||||
throws ResourceAlreadyPresentException, ResourceRegistryException;
|
throws ResourceAlreadyPresentException, ResourceRegistryException;
|
||||||
|
|
||||||
|
@ -56,47 +86,62 @@ public interface ResourceRegistryPublisher {
|
||||||
throws ResourceAlreadyPresentException, ResourceRegistryException;
|
throws ResourceAlreadyPresentException, ResourceRegistryException;
|
||||||
|
|
||||||
public String createResource(String resource) throws ResourceAlreadyPresentException, ResourceRegistryException;
|
public String createResource(String resource) throws ResourceAlreadyPresentException, ResourceRegistryException;
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public <R extends Resource> R updateResource(Class<R> resourceClass, R resource)
|
public <R extends Resource> R readResource(R resource)
|
||||||
throws ResourceNotFoundException, ResourceRegistryException;
|
throws ResourceNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public String readResource(String resourceType, UUID uuid) throws ResourceNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
public <R extends Resource> R updateResource(R resource)
|
public <R extends Resource> R updateResource(R resource)
|
||||||
throws ResourceNotFoundException, ResourceRegistryException;
|
throws ResourceNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public String updateResource(UUID uuid, String resource)
|
|
||||||
throws ResourceNotFoundException, ResourceRegistryException;
|
|
||||||
|
|
||||||
public String updateResource(String resource)
|
public String updateResource(String resource)
|
||||||
throws ResourceNotFoundException, ResourceRegistryException;
|
throws ResourceNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
public <R extends Resource> boolean deleteResource(R resource)
|
public <R extends Resource> boolean deleteResource(R resource)
|
||||||
throws ResourceNotFoundException, ResourceRegistryException;
|
throws ResourceNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public boolean deleteResource(UUID uuid) throws ResourceNotFoundException, ResourceRegistryException;
|
public boolean deleteResource(String resourceType, UUID uuid) throws ResourceNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C createConsistsOf(Class<C> consistsOfClass,
|
/* ----- */
|
||||||
C consistsOf) throws FacetNotFoundException, ResourceNotFoundException, ResourceRegistryException;
|
|
||||||
|
|
||||||
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C createConsistsOf(
|
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C createConsistsOf(
|
||||||
C consistsOf) throws FacetNotFoundException, ResourceNotFoundException, ResourceRegistryException;
|
C consistsOf) throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public String createConsistsOf(String consistsOfType, String consistsOf)
|
public String createConsistsOf(String consistsOfType, String consistsOf)
|
||||||
throws FacetNotFoundException, ResourceNotFoundException, ResourceRegistryException;
|
throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public String createConsistsOf(String consistsOf)
|
public String createConsistsOf(String consistsOf)
|
||||||
throws FacetNotFoundException, ResourceNotFoundException, ResourceRegistryException;
|
throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
|
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C readConsistsOf(
|
||||||
|
C consistsOf) throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public String readConsistsOf(String consistsOfType, UUID uuid) throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
|
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C updateConsistsOf(C consistsOf)
|
||||||
|
throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public String updateConsistsOf(String consistsOf)
|
||||||
|
throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> boolean deleteConsistsOf(C consistsOf)
|
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> boolean deleteConsistsOf(C consistsOf)
|
||||||
throws ResourceRegistryException;
|
throws ResourceRegistryException;
|
||||||
|
|
||||||
public boolean deleteConsistsOf(UUID uuid) throws ResourceRegistryException;
|
public boolean deleteConsistsOf(String consistsOfType, UUID uuid) throws ResourceRegistryException;
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I createIsRelatedTo(
|
|
||||||
Class<I> isRelatedToClass, I isRelatedTo) throws ResourceNotFoundException, ResourceRegistryException;
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ----- */
|
||||||
|
|
||||||
|
|
||||||
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I createIsRelatedTo(
|
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I createIsRelatedTo(
|
||||||
I isRelatedTo) throws ResourceNotFoundException, ResourceRegistryException;
|
I isRelatedTo) throws ResourceNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
@ -106,32 +151,106 @@ public interface ResourceRegistryPublisher {
|
||||||
public String createIsRelatedTo(String isRelatedTo)
|
public String createIsRelatedTo(String isRelatedTo)
|
||||||
throws ResourceNotFoundException, ResourceRegistryException;
|
throws ResourceNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
|
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I readIsRelatedTo(
|
||||||
|
I isRelatedTo) throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public String readIsRelatedTo(String isRelatedToType, UUID uuid) throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
|
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I updateIsRelatedTo(I isRelatedTo)
|
||||||
|
throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public String updateIsRelatedTo(String isRelatedTo)
|
||||||
|
throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> boolean deleteIsRelatedTo(I isRelatedTo)
|
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> boolean deleteIsRelatedTo(I isRelatedTo)
|
||||||
throws ResourceRegistryException;
|
throws ResourceRegistryException;
|
||||||
|
|
||||||
public boolean deleteIsRelatedTo(UUID uuid) throws ResourceRegistryException;
|
public boolean deleteIsRelatedTo(String isRelatedToType, UUID uuid) throws ResourceRegistryException;
|
||||||
|
|
||||||
public boolean addResourceToContext(UUID uuid)
|
|
||||||
|
/* ----- */
|
||||||
|
|
||||||
|
|
||||||
|
public boolean addToContext(UUID contextUUID, String erType, UUID instanceUUID)
|
||||||
|
throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public <E extends ER> boolean addToContext(UUID contextUUID, E er)
|
||||||
|
throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public boolean addToCurrentContext(String erType, UUID instanceUUID)
|
||||||
|
throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public <E extends ER> boolean addToCurrentContext(E er)
|
||||||
|
throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public boolean removeFromContext(UUID contextUUID, String erType, UUID instanceUUID)
|
||||||
|
throws NotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public <E extends ER> boolean removeFromContext(UUID contextUUID, E er)
|
||||||
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public boolean removeFromCurrentContext(String erType, UUID instanceUUID)
|
||||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public <R extends Resource> boolean addResourceToContext(R resource)
|
public <E extends ER> boolean removeFromCurrentContext(E er)
|
||||||
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
|
/* ----- */
|
||||||
|
|
||||||
|
|
||||||
|
public boolean addResourceToContext(UUID contextUUID, String resourceType, UUID resourceUUID)
|
||||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public boolean addFacetToContext(UUID uuid)
|
public <R extends Resource> boolean addResourceToContext(UUID contextUUID, R resource)
|
||||||
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public boolean addResourceToCurrentContext(String resourceType, UUID resourceUUID)
|
||||||
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public <R extends Resource> boolean addResourceToCurrentContext(R resource)
|
||||||
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public boolean removeResourceFromContext(UUID contextUUID, String resourceType, UUID resourceUUID)
|
||||||
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public <R extends Resource> boolean removeResourceFromContext(UUID contextUUID, R resource)
|
||||||
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public boolean removeResourceFromCurrentContext(String resourceType, UUID resourceUUID)
|
||||||
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public <R extends Resource> boolean removeResourceFromCurrentContext(R resource)
|
||||||
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
|
/* ----- */
|
||||||
|
|
||||||
|
|
||||||
|
public boolean addFacetToContext(UUID contextUUID, String facetType, UUID facetUUID)
|
||||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public <F extends Facet> boolean addFacetToContext(F facet)
|
public <F extends Facet> boolean addFacetToContext(UUID contextUUID, F facet)
|
||||||
|
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public boolean addFacetToCurrentContext(String facetType, UUID facetUUID)
|
||||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public boolean removeResourceFromContext(UUID uuid)
|
public <F extends Facet> boolean addFacetToCurrentContext(F facet)
|
||||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public <R extends Resource> boolean removeResourceFromContext(R resource)
|
public boolean removeFacetFromContext(UUID contextUUID, String facetType, UUID facetUUID)
|
||||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
|
||||||
|
|
||||||
public boolean removeFacetFromContext(UUID uuid)
|
|
||||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public <F extends Facet> boolean removeFacetFromContext(F facet)
|
public <F extends Facet> boolean removeFacetFromContext(UUID contextUUID, F facet)
|
||||||
|
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public boolean removeFacetFromCurrentContext(String facetType, UUID facetUUID)
|
||||||
|
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public <F extends Facet> boolean removeFacetFromCurrentContext(F facet)
|
||||||
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -230,8 +230,7 @@ public class ERManagementTest extends ScopedTest {
|
||||||
|
|
||||||
eService.getFacets(SoftwareFacet.class).get(0).setVersion("1.2.0");
|
eService.getFacets(SoftwareFacet.class).get(0).setVersion("1.2.0");
|
||||||
|
|
||||||
eServiceString = resourceRegistryPublisher.updateResource(eService.getHeader().getUUID(),
|
eServiceString = resourceRegistryPublisher.updateResource(ISMapper.marshal(eService));
|
||||||
ISMapper.marshal(eService));
|
|
||||||
eService = ISMapper.unmarshal(EService.class, eServiceString);
|
eService = ISMapper.unmarshal(EService.class, eServiceString);
|
||||||
|
|
||||||
Assert.assertTrue(eService.getFacets(SoftwareFacet.class).get(0).getVersion().compareTo("1.2.0") == 0);
|
Assert.assertTrue(eService.getFacets(SoftwareFacet.class).get(0).getVersion().compareTo("1.2.0") == 0);
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class EntityManagementTest extends ScopedTest {
|
||||||
String additionPropertyValue = "Test";
|
String additionPropertyValue = "Test";
|
||||||
createdCpuFacet.setAdditionalProperty(additionPropertyKey, additionPropertyValue);
|
createdCpuFacet.setAdditionalProperty(additionPropertyKey, additionPropertyValue);
|
||||||
|
|
||||||
String updatedCpuFacetString = resourceRegistryPublisher.updateFacet(createdCpuFacet.getHeader().getUUID(), ISMapper.marshal(createdCpuFacet));
|
String updatedCpuFacetString = resourceRegistryPublisher.updateFacet(ISMapper.marshal(createdCpuFacet));
|
||||||
|
|
||||||
CPUFacet updatedCpuFacet = ISMapper.unmarshal(CPUFacet.class, updatedCpuFacetString);
|
CPUFacet updatedCpuFacet = ISMapper.unmarshal(CPUFacet.class, updatedCpuFacetString);
|
||||||
Assert.assertTrue(createdCpuFacet.getClockSpeed().compareTo(updatedCpuFacet.getClockSpeed())==0);
|
Assert.assertTrue(createdCpuFacet.getClockSpeed().compareTo(updatedCpuFacet.getClockSpeed())==0);
|
||||||
|
|
|
@ -3,14 +3,9 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.informationsystem.resourceregistry.publisher;
|
package org.gcube.informationsystem.resourceregistry.publisher;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.gcube.informationsystem.impl.entity.facet.AccessPointFacetImpl;
|
import org.gcube.informationsystem.impl.entity.facet.AccessPointFacetImpl;
|
||||||
|
@ -54,9 +49,6 @@ import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*
|
*
|
||||||
|
@ -74,48 +66,6 @@ public class MultiContextTest extends ScopedTest {
|
||||||
resourceRegistryClient = ResourceRegistryClientFactory.create();
|
resourceRegistryClient = ResourceRegistryClientFactory.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void production() throws Exception {
|
|
||||||
File src = new File("src");
|
|
||||||
File test = new File(src, "test");
|
|
||||||
File resources = new File(test, "resources");
|
|
||||||
|
|
||||||
File tokenFile = new File(resources, "production-tokens-is-exporter.json");
|
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
JsonNode jsonNode = objectMapper.readTree(tokenFile);
|
|
||||||
|
|
||||||
Set<String> contexts = new HashSet<>();
|
|
||||||
contexts.add("/d4science.research-infrastructures.eu/ParthenosVO");
|
|
||||||
contexts.add("/d4science.research-infrastructures.eu/ParthenosVO/RubRIcA");
|
|
||||||
contexts.add("/d4science.research-infrastructures.eu/ParthenosVO/PARTHENOS_Registry");
|
|
||||||
|
|
||||||
|
|
||||||
String rootToken = jsonNode.get("/d4science.research-infrastructures.eu").asText();
|
|
||||||
ScopedTest.setContext(rootToken);
|
|
||||||
|
|
||||||
ResourceRegistryPublisher resourceRegistryPublisher = ResourceRegistryPublisherFactory.create();
|
|
||||||
//ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create();
|
|
||||||
|
|
||||||
|
|
||||||
List<String> uuids = new ArrayList<>();
|
|
||||||
uuids.add("ac88cc20-9589-4e0b-9115-7af6e0bd7abc");
|
|
||||||
uuids.add("38823ddc-0713-4e83-9670-79e472408b0c");
|
|
||||||
|
|
||||||
for(String context : contexts){
|
|
||||||
String token = jsonNode.get(context).asText();
|
|
||||||
ScopedTest.setContext(token);
|
|
||||||
|
|
||||||
for(String uuidString : uuids){
|
|
||||||
UUID uuid = UUID.fromString(uuidString);
|
|
||||||
resourceRegistryPublisher.addResourceToContext(uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateEServiceHostingNode() throws Exception {
|
public void testCreateEServiceHostingNode() throws Exception {
|
||||||
EService eService = new EServiceImpl();
|
EService eService = new EServiceImpl();
|
||||||
|
@ -230,7 +180,7 @@ public class MultiContextTest extends ScopedTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean addedToContext = resourceRegistryPublisher.addResourceToContext(hostingNodeUUID);
|
boolean addedToContext = resourceRegistryPublisher.addResourceToCurrentContext(createdHN);
|
||||||
Assert.assertTrue(addedToContext);
|
Assert.assertTrue(addedToContext);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue