Skip to content

Commit b6b68e7

Browse files
committed
Updated unit tests
1 parent e7cd78f commit b6b68e7

4 files changed

Lines changed: 386 additions & 337 deletions

File tree

contrib/storage-sentinel/src/main/java/org/apache/drill/exec/store/sentinel/SentinelBatchReader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ public void close() {
149149

150150
private void queryLogAnalytics() throws IOException {
151151
String queryUrl = String.format(
152-
"https://api.loganalytics.io/v1/workspaces/%s/query",
152+
"%s/workspaces/%s/query",
153+
config.getApiEndpoint(),
153154
config.getWorkspaceId());
154155

155156
String token = tokenManager.getBearerToken(username);

contrib/storage-sentinel/src/main/java/org/apache/drill/exec/store/sentinel/SentinelStoragePluginConfig.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class SentinelStoragePluginConfig extends StoragePluginConfig {
3737
private final String defaultTimespan;
3838
private final int maxRows;
3939
private final List<String> tables;
40+
private final String apiEndpoint;
4041

4142
@JsonCreator
4243
public SentinelStoragePluginConfig(
@@ -48,7 +49,8 @@ public SentinelStoragePluginConfig(
4849
@JsonProperty("maxRows") int maxRows,
4950
@JsonProperty("tables") List<String> tables,
5051
@JsonProperty("authMode") AuthMode authMode,
51-
@JsonProperty("credentialsProvider") CredentialsProvider credentialsProvider) {
52+
@JsonProperty("credentialsProvider") CredentialsProvider credentialsProvider,
53+
@JsonProperty("apiEndpoint") String apiEndpoint) {
5254
super(CredentialProviderUtils.getCredentialsProvider(clientId, clientSecret, null, null,
5355
null, null, null, credentialsProvider), false, authMode);
5456
this.workspaceId = workspaceId;
@@ -58,6 +60,7 @@ public SentinelStoragePluginConfig(
5860
this.defaultTimespan = defaultTimespan != null ? defaultTimespan : "P1D";
5961
this.maxRows = maxRows > 0 ? maxRows : 10000;
6062
this.tables = tables != null ? tables : List.of();
63+
this.apiEndpoint = apiEndpoint != null ? apiEndpoint : "https://api.loganalytics.io/v1";
6164
}
6265

6366
public SentinelStoragePluginConfig(SentinelStoragePluginConfig that, CredentialsProvider credentialsProvider) {
@@ -69,6 +72,7 @@ public SentinelStoragePluginConfig(SentinelStoragePluginConfig that, Credentials
6972
this.defaultTimespan = that.defaultTimespan;
7073
this.maxRows = that.maxRows;
7174
this.tables = that.tables;
75+
this.apiEndpoint = that.apiEndpoint;
7276
}
7377

7478
public String getWorkspaceId() {
@@ -99,6 +103,10 @@ public List<String> getTables() {
99103
return tables;
100104
}
101105

106+
public String getApiEndpoint() {
107+
return apiEndpoint;
108+
}
109+
102110
public AuthMode getAuthMode() {
103111
return authMode;
104112
}
@@ -123,13 +131,14 @@ public boolean equals(Object o) {
123131
&& Objects.equals(clientSecret, that.clientSecret)
124132
&& Objects.equals(defaultTimespan, that.defaultTimespan)
125133
&& Objects.equals(tables, that.tables)
134+
&& Objects.equals(apiEndpoint, that.apiEndpoint)
126135
&& Objects.equals(credentialsProvider, that.credentialsProvider)
127136
&& authMode == that.authMode;
128137
}
129138

130139
@Override
131140
public int hashCode() {
132-
return Objects.hash(workspaceId, tenantId, clientId, clientSecret, defaultTimespan, maxRows, tables, credentialsProvider, authMode);
141+
return Objects.hash(workspaceId, tenantId, clientId, clientSecret, defaultTimespan, maxRows, tables, apiEndpoint, credentialsProvider, authMode);
133142
}
134143

135144
@Override
@@ -141,6 +150,7 @@ public String toString() {
141150
", defaultTimespan='" + defaultTimespan + '\'' +
142151
", maxRows=" + maxRows +
143152
", tables=" + tables +
153+
", apiEndpoint='" + apiEndpoint + '\'' +
144154
", authMode=" + authMode +
145155
'}';
146156
}

0 commit comments

Comments
 (0)