smiklosovic commented on code in PR #2458:
URL: https://github.com/apache/cassandra/pull/2458#discussion_r1257909237


##########
src/java/org/apache/cassandra/locator/AbstractCloudMetadataServiceConnector.java:
##########
@@ -25,22 +25,41 @@
 import java.net.URL;
 import java.util.Map;
 
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableMap;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 
 abstract class AbstractCloudMetadataServiceConnector
 {
+    static final String METADATA_URL_PROPERTY = "metadata_url";
+
+    public static class DefaultCloudMetadataServiceConnector extends 
AbstractCloudMetadataServiceConnector
+    {
+        protected DefaultCloudMetadataServiceConnector(String 
metadataServiceUrl)
+        {
+            super(metadataServiceUrl);
+        }
+    }
+
     protected final String metadataServiceUrl;
 
+    @VisibleForTesting // for mockito
+    protected String getMetadataServiceUrl()
+    {
+        return metadataServiceUrl;
+    }
+
     protected AbstractCloudMetadataServiceConnector(String metadataServiceUrl)
     {
+        Preconditions.checkNotNull(metadataServiceUrl, METADATA_URL_PROPERTY + 
" for a connector can not be null");
         this.metadataServiceUrl = metadataServiceUrl;
     }
 
     public String apiCall(String query) throws IOException
     {
-        return apiCall(metadataServiceUrl, query, 200);
+        return apiCall(getMetadataServiceUrl(), query, 200);

Review Comment:
   This is here due to tests. I had to mock what that method would return, this 
can not be done on a field.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to