-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
* Remove commons lang lib #415
base: master
Are you sure you want to change the base?
Conversation
* Remove usage of Pair
Test Results149 tests - 183 149 ✅ - 174 5s ⏱️ - 4m 2s Results for commit 944834d. ± Comparison against base commit 945e8e5. This pull request removes 183 tests.
♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update changelog.md
public static final Set<String> KUSTO_LITERAL_PREFIX = Stream.of("H", "h").collect(Collectors.toCollection(HashSet::new)); | ||
public static final Set<String> KUSTO_MULTILINE_QUOTE_DELIMITERS = Stream.of("```", "~~~").collect(Collectors.toCollection(HashSet::new)); | ||
public static final Set<String> KUSTO_ESCAPE_SEQUENCES = Stream.of("\\\"", "'", "@\\\"", "@'").collect(Collectors.toCollection(HashSet::new)); | ||
private static final Set<String> KUSTO_LITERAL_PREFIX = Stream.of("H", "h").collect(Collectors.toCollection(HashSet::new)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically these are breaking changes, but I think it's ok they're private. We just need to document in the changelog
@@ -23,6 +22,8 @@ public class ConnectionStringBuilder { | |||
public static final String DEFAULT_DATABASE_NAME = "NetDefaultDb"; | |||
|
|||
private static final String DEFAULT_DEVICE_AUTH_TENANT = "organizations"; | |||
private static final String CLUSTER_URL_CANNOT_BE_NULL_OR_EMPTY = "clusterUrl cannot be null or empty"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we'll have some sort of helper method to throw if null or empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, we already have it with Ensure - let's use that
@@ -125,53 +126,46 @@ private void assignValue(String rawKey, String value) { | |||
} | |||
|
|||
public String toString(boolean showSecrets) { | |||
ArrayList<Pair<KnownKeywords, String>> entries = new ArrayList<>(); | |||
Map<KnownKeywords, String> entries = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I didn't use map in the first place is because it doesn't keep the order. But I think you can use LinkedHashMap
which will keep the order
@@ -629,15 +621,15 @@ public static ConnectionStringBuilder createWithTokenCredential(@NotNull String | |||
* @param appName The app hosting the connector, or null to use the current process name. | |||
* @param appVersion The version of the app hosting the connector, or null to use "[none]". | |||
* @param sendUser True if the user should be sent to Kusto, otherwise "[none]" will be sent. | |||
* @param overrideUser The user to send to Kusto, or null zvto use the current user. | |||
* @param overrideUser The user to send to Kusto, or null to use the current user. | |||
* @param additionalFields Additional fields to trace. | |||
* Example: "Kusto.MyConnector:{1.0.0}|App.{connector}:{0.5.3}|Kusto.MyField:{MyValue}" | |||
*/ | |||
public void setConnectorDetails(String name, String version, @Nullable String appName, @Nullable String appVersion, boolean sendUser, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also needs to be documented in the changelog
@@ -7,6 +7,8 @@ | |||
import java.util.Map; | |||
|
|||
public class Tracer { | |||
private Tracer() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? to prevent construction?
@@ -147,7 +148,7 @@ public void testSetConnectorNameAndVersion() throws URISyntaxException, DataClie | |||
@Test | |||
public void testSetConnectorNoAppVersion() throws URISyntaxException, DataClientException { | |||
ConnectionStringBuilder csb = ConnectionStringBuilder.createWithAadManagedIdentity("https://testcluster.kusto.windows.net"); | |||
csb.setConnectorDetails("myConnector", "myVersion", null, null, true, "myApp"); | |||
csb.setConnectorDetails("myConnector", "myVersion", null, null, true, "myApp", Collections.emptyMap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should still work ok if it gets null
private String appendedClientVersionForTracing; | ||
|
||
private static final ConcurrentHashMap<String, String> defaultValues = new ConcurrentHashMap<>(); | ||
public static final String DEFAULT_APPLICATION = "defaultApplication"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool idea to use ConcurrentHasmap's computeifabsent and then access these as keys.
But maybe instead of strings, it should be an enum?
We had a strange issue in spark yesterday where commons lang with var-args in setConnector details was causing an issue. Thought of removing these libs