diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientFactory.java b/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientFactory.java index e4c63c4..ff42a8d 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientFactory.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientFactory.java @@ -26,21 +26,8 @@ public class ResourceRegistryClientFactory { return authorizationEntry.getContext(); } - private static String FORCED_URL = null; - - protected static void forceToURL(String url){ - FORCED_URL = url; - } - public static ResourceRegistryClient create() { - String address = null; - - if(FORCED_URL!=null){ - address = FORCED_URL; - }else { - address = String.format("%s/%s", ServiceInstance.getServiceURL(),Constants.SERVICE_NAME); - } - + String address = String.format("%s/%s", ServiceInstance.getServiceURL(),Constants.SERVICE_NAME); logger.trace("The {} will be contacted at {}", Constants.SERVICE_NAME, address); return new ResourceRegistryClientImpl(address); } diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/client/ContextTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/client/ContextTest.java index 49f2236..22dfd0f 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/client/ContextTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/client/ContextTest.java @@ -80,10 +80,7 @@ public class ContextTest { } RESOURCE_REGISTRY_URL = registryProperties.getProperty(RESOURCE_REGISTRY_URL_PROPERTY); - - if(RESOURCE_REGISTRY_URL!=null){ - ResourceRegistryClientFactory.forceToURL(RESOURCE_REGISTRY_URL); - } + } public static String getCurrentScope(String token) throws ObjectNotFound, Exception { diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientTest.java index 731ed25..d66f054 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientTest.java @@ -44,7 +44,11 @@ public class ResourceRegistryClientTest extends ContextTest { protected ResourceRegistryClient resourceRegistryClient; public ResourceRegistryClientTest() { - resourceRegistryClient = ResourceRegistryClientFactory.create(); + if(ContextTest.RESOURCE_REGISTRY_URL !=null && !ContextTest.RESOURCE_REGISTRY_URL.isEmpty()) { + resourceRegistryClient = new ResourceRegistryClientImpl(ContextTest.RESOURCE_REGISTRY_URL); + }else { + resourceRegistryClient = ResourceRegistryClientFactory.create(); + } } @Test diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientTestWikiExamples.java b/src/test/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientTestWikiExamples.java index 822b22c..37c8f25 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientTestWikiExamples.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientTestWikiExamples.java @@ -38,7 +38,11 @@ public class ResourceRegistryClientTestWikiExamples extends ContextTest { protected ResourceRegistryClient resourceRegistryClient; public ResourceRegistryClientTestWikiExamples() { - resourceRegistryClient = ResourceRegistryClientFactory.create(); + if(ContextTest.RESOURCE_REGISTRY_URL !=null && !ContextTest.RESOURCE_REGISTRY_URL.isEmpty()) { + resourceRegistryClient = new ResourceRegistryClientImpl(ContextTest.RESOURCE_REGISTRY_URL); + }else { + resourceRegistryClient = ResourceRegistryClientFactory.create(); + } } @Before