diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/queries/templates/ResourceRegistryQueryTemplateClientFactory.java b/src/main/java/org/gcube/informationsystem/resourceregistry/queries/templates/ResourceRegistryQueryTemplateClientFactory.java index e866e68..61c45fd 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/queries/templates/ResourceRegistryQueryTemplateClientFactory.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/queries/templates/ResourceRegistryQueryTemplateClientFactory.java @@ -26,21 +26,8 @@ public class ResourceRegistryQueryTemplateClientFactory { return authorizationEntry.getContext(); } - private static String FORCED_URL = null; - - protected static void forceToURL(String url){ - FORCED_URL = url; - } - public static ResourceRegistryQueryTemplateClient 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 ResourceRegistryQueryTemplateClientImpl(address); } diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/queries/templates/ContextTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/queries/templates/ContextTest.java index 4adc7cf..763957d 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/queries/templates/ContextTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/queries/templates/ContextTest.java @@ -80,10 +80,7 @@ public class ContextTest { } RESOURCE_REGISTRY_URL = registryProperties.getProperty(RESOURCE_REGISTRY_URL_PROPERTY); - - if(RESOURCE_REGISTRY_URL!=null){ - ResourceRegistryQueryTemplateClientFactory.forceToURL(RESOURCE_REGISTRY_URL); - } + } public static String getCurrentScope(String token) throws ObjectNotFound, Exception { diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/queries/templates/ResourceRegistryQueryTemplateClientTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/queries/templates/ResourceRegistryQueryTemplateClientTest.java index f6f308e..d27e7e9 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/queries/templates/ResourceRegistryQueryTemplateClientTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/queries/templates/ResourceRegistryQueryTemplateClientTest.java @@ -42,7 +42,11 @@ public class ResourceRegistryQueryTemplateClientTest extends ContextTest { protected ResourceRegistryQueryTemplateClient resourceRegistryQueryTemplateClient; public ResourceRegistryQueryTemplateClientTest() { - resourceRegistryQueryTemplateClient = ResourceRegistryQueryTemplateClientFactory.create(); + if(ContextTest.RESOURCE_REGISTRY_URL !=null && !ContextTest.RESOURCE_REGISTRY_URL.isEmpty()) { + resourceRegistryQueryTemplateClient = new ResourceRegistryQueryTemplateClientImpl(ContextTest.RESOURCE_REGISTRY_URL); + }else { + resourceRegistryQueryTemplateClient = ResourceRegistryQueryTemplateClientFactory.create(); + } } public static String getUser() {