comment
stringlengths
1
45k
method_body
stringlengths
23
281k
target_code
stringlengths
0
5.16k
method_body_after
stringlengths
12
281k
context_before
stringlengths
8
543k
context_after
stringlengths
8
543k
Correct: The `CosmosClientException` originates in the Direct TCP stack and so `reactor.core.Exceptions.unwrap` is not needed.
public Mono<StoreResponse> invokeStoreAsync(final Uri addressUri, final RxDocumentServiceRequest request) { logger.debug("RntbdTransportClient.invokeStoreAsync({}, {})", addressUri, request); checkNotNull(addressUri, "expected non-null address"); checkNotNull(request, "expected non-null request"); this.throwIfClosed();...
} else if (throwable instanceof CosmosClientException) {
public Mono<StoreResponse> invokeStoreAsync(final Uri addressUri, final RxDocumentServiceRequest request) { logger.debug("RntbdTransportClient.invokeStoreAsync({}, {})", addressUri, request); checkNotNull(addressUri, "expected non-null address"); checkNotNull(request, "expected non-null request"); this.throwIfClosed();...
class RntbdTransportClient extends TransportClient { private static final String TAG_NAME = RntbdTransportClient.class.getSimpleName(); private static final AtomicLong instanceCount = new AtomicLong(); private static final Logger logger = LoggerFactory.getLogger(RntbdTransportClient.class); private final AtomicBoolean ...
class RntbdTransportClient extends TransportClient { private static final String TAG_NAME = RntbdTransportClient.class.getSimpleName(); private static final AtomicLong instanceCount = new AtomicLong(); private static final Logger logger = LoggerFactory.getLogger(RntbdTransportClient.class); private final AtomicBoolean ...
nit: can remove final here and other examples.
public void detectLanguageForListInputTextsWithResponse() { final List<String> textInputs = Arrays.asList( "This is written in English", "Este es un document escrito en Español."); final DocumentResultCollection<DetectLanguageResult> detectLanguageResults = textAnalyticsClient.detectLanguagesWithResponse(textInputs, "U...
final DocumentResultCollection<DetectLanguageResult> detectLanguageResults =
public void detectLanguageForListInputTextsWithResponse() { final List<String> textInputs = Arrays.asList( "This is written in English", "Este es un document escrito en Español."); final DocumentResultCollection<DetectLanguageResult> detectLanguageResults = textAnalyticsClient.detectLanguagesWithResponse(textInputs, "U...
class TextAnalyticsClientJavaDocCodeSnippets { private static final String SUBSCRIPTION_KEY = null; private static final String ENDPOINT = null; private final TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for creating a {@link TextAnalyticsClient} with pipe...
class TextAnalyticsClientJavaDocCodeSnippets { private static final String SUBSCRIPTION_KEY = null; private static final String ENDPOINT = null; private final TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for creating a {@link TextAnalyticsClient} with pipe...
Can make the snippet shorter? here and other examples.
public void recognizeEntitiesSingleText() { final RecognizeEntitiesResult recognizeEntitiesResult = textAnalyticsClient.recognizeEntities("Satya Nadella is the CEO of Microsoft"); for (NamedEntity entity : recognizeEntitiesResult.getNamedEntities()) { System.out.printf( "Recognized entity: %s, entity type: %s, entity s...
entity.getSubtype() == null || entity.getSubtype().isEmpty() ? "N/A" : entity.getSubtype(),
public void recognizeEntitiesSingleText() { final RecognizeEntitiesResult recognizeEntitiesResult = textAnalyticsClient.recognizeEntities("Satya Nadella is the CEO of Microsoft"); for (NamedEntity entity : recognizeEntitiesResult.getNamedEntities()) { System.out.printf("Recognized entity: %s, entity type: %s, score: %s...
class TextAnalyticsClientJavaDocCodeSnippets { private static final String SUBSCRIPTION_KEY = null; private static final String ENDPOINT = null; private final TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for creating a {@link TextAnalyticsClient} with pipe...
class TextAnalyticsClientJavaDocCodeSnippets { private static final String SUBSCRIPTION_KEY = null; private static final String ENDPOINT = null; private final TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for creating a {@link TextAnalyticsClient} with pipe...
susceptible to SQL injection attack.
public Mono<Integer> readMinThroughput() { return this.read().flatMap(cosmosContainerResponse -> database.getDocClientWrapper() .queryOffers("select * from c where c.offerResourceId = '" + cosmosContainerResponse.resourceSettings().resourceId() + "'", new FeedOptions()) .single()).flatMap(offerFeedResponse -> { if (off...
+ cosmosContainerResponse.resourceSettings().resourceId() + "'", new FeedOptions())
public Mono<Integer> readMinThroughput() { return this.read().flatMap(cosmosContainerResponse -> database.getDocClientWrapper() .queryOffers( new SqlQuerySpec("select * from c where c.offerResourceId = @OFFER_RESOURCE_ID", new SqlParameterList(new SqlParameter("@OFFER_RESOURCE_ID", cosmosContainerResponse.resourceSetti...
class CosmosContainer { private CosmosDatabase database; private String id; private CosmosScripts scripts; CosmosContainer(String id, CosmosDatabase database) { this.id = id; this.database = database; } /** * Get the id of the {@link CosmosContainer} * * @return the id of the {@link CosmosContainer} */ public String id...
class CosmosContainer { private CosmosDatabase database; private String id; private CosmosScripts scripts; CosmosContainer(String id, CosmosDatabase database) { this.id = id; this.database = database; } /** * Get the id of the {@link CosmosContainer} * * @return the id of the {@link CosmosContainer} */ public String id...
Fixed in latest iteration
public Mono<Integer> readMinThroughput() { return this.read().flatMap(cosmosContainerResponse -> database.getDocClientWrapper() .queryOffers("select * from c where c.offerResourceId = '" + cosmosContainerResponse.resourceSettings().resourceId() + "'", new FeedOptions()) .single()).flatMap(offerFeedResponse -> { if (off...
+ cosmosContainerResponse.resourceSettings().resourceId() + "'", new FeedOptions())
public Mono<Integer> readMinThroughput() { return this.read().flatMap(cosmosContainerResponse -> database.getDocClientWrapper() .queryOffers( new SqlQuerySpec("select * from c where c.offerResourceId = @OFFER_RESOURCE_ID", new SqlParameterList(new SqlParameter("@OFFER_RESOURCE_ID", cosmosContainerResponse.resourceSetti...
class CosmosContainer { private CosmosDatabase database; private String id; private CosmosScripts scripts; CosmosContainer(String id, CosmosDatabase database) { this.id = id; this.database = database; } /** * Get the id of the {@link CosmosContainer} * * @return the id of the {@link CosmosContainer} */ public String id...
class CosmosContainer { private CosmosDatabase database; private String id; private CosmosScripts scripts; CosmosContainer(String id, CosmosDatabase database) { this.id = id; this.database = database; } /** * Get the id of the {@link CosmosContainer} * * @return the id of the {@link CosmosContainer} */ public String id...
Parameterized type, please change this to `LatencyListener<T>`... `new LatencyListener<>(resultHandler, ...)`
void run() throws Exception { successMeter = metricsRegistry.meter(" failureMeter = metricsRegistry.meter(" switch (configuration.getOperationType()) { case ReadLatency: case Mixed: latency = metricsRegistry.timer("Latency"); break; default: break; } reporter.start(configuration.getPrintingInterval(), TimeUnit.SECONDS)...
LatencyListener latencyListener = new LatencyListener(resultHandler, latency);
void run() throws Exception { successMeter = metricsRegistry.meter(" failureMeter = metricsRegistry.meter(" switch (configuration.getOperationType()) { case ReadLatency: case Mixed: latency = metricsRegistry.timer("Latency"); break; default: break; } reporter.start(configuration.getPrintingInterval(), TimeUnit.SECONDS)...
class LatencyListener<T> extends ResultHandler<T, Throwable> { private final ResultHandler<T, Throwable> baseFunction; Timer.Context context; LatencyListener(ResultHandler<T, Throwable> baseFunction, Timer latency) { this.baseFunction = baseFunction; } protected void init() { super.init(); context = latency.time(); } @...
class LatencyListener<T> extends ResultHandler<T, Throwable> { private final ResultHandler<T, Throwable> baseFunction; private final Timer latencyTimer; Timer.Context context; LatencyListener(ResultHandler<T, Throwable> baseFunction, Timer latencyTimer) { this.baseFunction = baseFunction; this.latencyTimer = latencyTim...
Use `try-with-resources` to ensure the resource is always closed.
void writeWithThrowable(StringBuilder buf, Throwable t) { if (t != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); buf.append(sw.toString()); pw.close(); } System.out.println(buf.toString()); }
pw.close();
void writeWithThrowable(StringBuilder buf, Throwable t) { if (t != null) { StringWriter sw = new StringWriter(); try (PrintWriter pw = new PrintWriter(sw)) { t.printStackTrace(pw); buf.append(sw.toString()); } } System.out.println(buf.toString()); }
class name. * * @param className Class name creating the logger. * @throws RuntimeException it is an error. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
class name passes in. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
Since StringWriter has no-op close(), I only move pw to try with resource. Thanks for pointing this out!
void writeWithThrowable(StringBuilder buf, Throwable t) { if (t != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); buf.append(sw.toString()); pw.close(); } System.out.println(buf.toString()); }
pw.close();
void writeWithThrowable(StringBuilder buf, Throwable t) { if (t != null) { StringWriter sw = new StringWriter(); try (PrintWriter pw = new PrintWriter(sw)) { t.printStackTrace(pw); buf.append(sw.toString()); } } System.out.println(buf.toString()); }
class name. * * @param className Class name creating the logger. * @throws RuntimeException it is an error. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
class name passes in. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
Generally, you try to limit the scope of your assertion. How do you know it threw in credential(null) and not buildclient()? This goes for all the other tests that do the same. ```java // arrange final TextAnalyticsClientBuilder builder = new TextAnalyticsClientBuilder(); // Act & Assert assertThrows(NullPointerExce...
public void nullAADCredential() { assertThrows(NullPointerException.class, () -> { final TextAnalyticsClientBuilder builder = new TextAnalyticsClientBuilder(); builder.endpoint(getEndpoint()).credential(null).buildClient(); }); }
builder.endpoint(getEndpoint()).credential(null).buildClient();
public void nullAADCredential() { assertThrows(NullPointerException.class, () -> { final TextAnalyticsClientBuilder builder = new TextAnalyticsClientBuilder(); builder.endpoint(getEndpoint()).credential(null); }); }
class TextAnalyticsClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsClient client; @Override protected void beforeTest() { client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() .endpoint(getEndpoint()) .pipeline(httpPipeline) .buildClient()); } /** * Verify that we can get statistic...
class TextAnalyticsClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsClient client; @Override protected void beforeTest() { client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() .endpoint(getEndpoint()) .pipeline(httpPipeline) .buildClient()); } /** * Verify that we can get statistic...
If we log an error that doesn't have any vararg arguments this will throw an exception from what I understand.
public void error(final String msg) { throw new UnsupportedOperationException(); }
throw new UnsupportedOperationException();
public void error(final String msg) { logMessageWithFormat("ERROR", msg); }
class name. * * @param className Class name creating the logger. * @throws RuntimeException it is an error. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
class name passes in. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
``` logger.error(format, args); ``` This is the one we used.
public void error(final String msg) { throw new UnsupportedOperationException(); }
throw new UnsupportedOperationException();
public void error(final String msg) { logMessageWithFormat("ERROR", msg); }
class name. * * @param className Class name creating the logger. * @throws RuntimeException it is an error. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
class name passes in. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
This code is common for all `is*Enabled()` methods. You can extract this out to a method to reduce duplication.
public boolean isDebugEnabled() { String logLevelStr = Configuration.getGlobalConfiguration().get(AZURE_LOG_LEVEL); LogLevel currentLogLevel = LogLevel.fromString(logLevelStr); return LogLevel.VERBOSE.getLogLevel() >= currentLogLevel.getLogLevel(); }
return LogLevel.VERBOSE.getLogLevel() >= currentLogLevel.getLogLevel();
public boolean isDebugEnabled() { return isLogLevelEnabledFromEnv(LogLevel.VERBOSE); }
class name. * * @param className Class name creating the logger. * @throws RuntimeException it is an error. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
class name passes in. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
This null check is still required otherwise it will cause a NPE.
public boolean canLogAtLevel(LogLevel logLevel) { switch (logLevel) { case VERBOSE: return logger.isDebugEnabled(); case INFORMATIONAL: return logger.isInfoEnabled(); case WARNING: return logger.isWarnEnabled(); case ERROR: return logger.isErrorEnabled(); default: return false; } }
switch (logLevel) {
public boolean canLogAtLevel(LogLevel logLevel) { if (logLevel == null) { return false; } switch (logLevel) { case VERBOSE: return logger.isDebugEnabled(); case INFORMATIONAL: return logger.isInfoEnabled(); case WARNING: return logger.isWarnEnabled(); case ERROR: return logger.isErrorEnabled(); default: return false; }...
class name using the {@link LoggerFactory}
class name using the {@link LoggerFactory}
Should this logic be abstracted into `LoggingUtils` or as a private static method on this class?
public boolean isDebugEnabled() { String logLevelStr = Configuration.getGlobalConfiguration().get(AZURE_LOG_LEVEL); LogLevel currentLogLevel = LogLevel.fromString(logLevelStr); return LogLevel.VERBOSE.getLogLevel() >= currentLogLevel.getLogLevel(); }
LogLevel currentLogLevel = LogLevel.fromString(logLevelStr);
public boolean isDebugEnabled() { return isLogLevelEnabledFromEnv(LogLevel.VERBOSE); }
class name. * * @param className Class name creating the logger. * @throws RuntimeException it is an error. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
class name passes in. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
One of the SDK guidelines it to only print an exception's stack trace when logging is set to verbose. In `ClientLogger` it was set to only log the exception message at a different level.
void writeWithThrowable(StringBuilder buf, Throwable t) { if (t != null) { StringWriter sw = new StringWriter(); try (PrintWriter pw = new PrintWriter(sw)) { t.printStackTrace(pw); buf.append(sw.toString()); } } System.out.println(buf.toString()); }
}
void writeWithThrowable(StringBuilder buf, Throwable t) { if (t != null) { StringWriter sw = new StringWriter(); try (PrintWriter pw = new PrintWriter(sw)) { t.printStackTrace(pw); buf.append(sw.toString()); } } System.out.println(buf.toString()); }
class name. * * @param className Class name creating the logger. * @throws RuntimeException it is an error. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
class name passes in. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
Done.
public boolean canLogAtLevel(LogLevel logLevel) { switch (logLevel) { case VERBOSE: return logger.isDebugEnabled(); case INFORMATIONAL: return logger.isInfoEnabled(); case WARNING: return logger.isWarnEnabled(); case ERROR: return logger.isErrorEnabled(); default: return false; } }
switch (logLevel) {
public boolean canLogAtLevel(LogLevel logLevel) { if (logLevel == null) { return false; } switch (logLevel) { case VERBOSE: return logger.isDebugEnabled(); case INFORMATIONAL: return logger.isInfoEnabled(); case WARNING: return logger.isWarnEnabled(); case ERROR: return logger.isErrorEnabled(); default: return false; }...
class name using the {@link LoggerFactory}
class name using the {@link LoggerFactory}
Done.
public boolean isDebugEnabled() { String logLevelStr = Configuration.getGlobalConfiguration().get(AZURE_LOG_LEVEL); LogLevel currentLogLevel = LogLevel.fromString(logLevelStr); return LogLevel.VERBOSE.getLogLevel() >= currentLogLevel.getLogLevel(); }
return LogLevel.VERBOSE.getLogLevel() >= currentLogLevel.getLogLevel();
public boolean isDebugEnabled() { return isLogLevelEnabledFromEnv(LogLevel.VERBOSE); }
class name. * * @param className Class name creating the logger. * @throws RuntimeException it is an error. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
class name passes in. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
Have a private helper method in class. Env log level is only needed for default logger, so it is ok to leave it here for current use.
public boolean isDebugEnabled() { String logLevelStr = Configuration.getGlobalConfiguration().get(AZURE_LOG_LEVEL); LogLevel currentLogLevel = LogLevel.fromString(logLevelStr); return LogLevel.VERBOSE.getLogLevel() >= currentLogLevel.getLogLevel(); }
LogLevel currentLogLevel = LogLevel.fromString(logLevelStr);
public boolean isDebugEnabled() { return isLogLevelEnabledFromEnv(LogLevel.VERBOSE); }
class name. * * @param className Class name creating the logger. * @throws RuntimeException it is an error. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
class name passes in. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
Talked offline.
void writeWithThrowable(StringBuilder buf, Throwable t) { if (t != null) { StringWriter sw = new StringWriter(); try (PrintWriter pw = new PrintWriter(sw)) { t.printStackTrace(pw); buf.append(sw.toString()); } } System.out.println(buf.toString()); }
}
void writeWithThrowable(StringBuilder buf, Throwable t) { if (t != null) { StringWriter sw = new StringWriter(); try (PrintWriter pw = new PrintWriter(sw)) { t.printStackTrace(pw); buf.append(sw.toString()); } } System.out.println(buf.toString()); }
class name. * * @param className Class name creating the logger. * @throws RuntimeException it is an error. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
class name passes in. */ public DefaultLogger(String className) { try { this.classPath = Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException e) { this.classPath = className; } }
Make sense. I will update it.
public void nullAADCredential() { assertThrows(NullPointerException.class, () -> { final TextAnalyticsClientBuilder builder = new TextAnalyticsClientBuilder(); builder.endpoint(getEndpoint()).credential(null).buildClient(); }); }
builder.endpoint(getEndpoint()).credential(null).buildClient();
public void nullAADCredential() { assertThrows(NullPointerException.class, () -> { final TextAnalyticsClientBuilder builder = new TextAnalyticsClientBuilder(); builder.endpoint(getEndpoint()).credential(null); }); }
class TextAnalyticsClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsClient client; @Override protected void beforeTest() { client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() .endpoint(getEndpoint()) .pipeline(httpPipeline) .buildClient()); } /** * Verify that we can get statistic...
class TextAnalyticsClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsClient client; @Override protected void beforeTest() { client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() .endpoint(getEndpoint()) .pipeline(httpPipeline) .buildClient()); } /** * Verify that we can get statistic...
Seems like we should introduce a method something like envContains(params string var) that returns true if the env contains all of the 'var's.
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.fromSupplier(() -> { if (configuration.contains(Configuration.PROPERTY_AZURE_CLIENT_ID) && configuration.contains(Configuration.PROPERTY_AZURE_CLIENT_SECRET) && configuration.contains(Configuration.PROPERTY_AZURE_TENANT_ID)) { return new Clien...
} else if (configuration.contains(Configuration.PROPERTY_AZURE_CLIENT_ID)
public Mono<AccessToken> getToken(TokenRequestContext request) { String clientId = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_ID); String tenantId = configuration.get(Configuration.PROPERTY_AZURE_TENANT_ID); String clientSecret = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_SECRET); String certPath ...
class EnvironmentCredential implements TokenCredential { private final Configuration configuration; private final IdentityClientOptions identityClientOptions; private final ClientLogger logger = new ClientLogger(EnvironmentCredential.class); /** * Creates an instance of the default environment credential provider. * * ...
class EnvironmentCredential implements TokenCredential { private final Configuration configuration; private final IdentityClientOptions identityClientOptions; private final ClientLogger logger = new ClientLogger(EnvironmentCredential.class); /** * Creates an instance of the default environment credential provider. * * ...
Is this not explicitly needed by `UsernamePasswordCredential`? Otherwise the validation check is missing this.
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.fromSupplier(() -> { if (configuration.containsAll(Configuration.PROPERTY_AZURE_TENANT_ID, Configuration.PROPERTY_AZURE_CLIENT_ID, Configuration.PROPERTY_AZURE_CLIENT_SECRET)) { return new ClientSecretCredential(configuration.get(Configuration...
configuration.get(Configuration.PROPERTY_AZURE_TENANT_ID),
public Mono<AccessToken> getToken(TokenRequestContext request) { String clientId = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_ID); String tenantId = configuration.get(Configuration.PROPERTY_AZURE_TENANT_ID); String clientSecret = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_SECRET); String certPath ...
class EnvironmentCredential implements TokenCredential { private final Configuration configuration; private final IdentityClientOptions identityClientOptions; private final ClientLogger logger = new ClientLogger(EnvironmentCredential.class); /** * Creates an instance of the default environment credential provider. * * ...
class EnvironmentCredential implements TokenCredential { private final Configuration configuration; private final IdentityClientOptions identityClientOptions; private final ClientLogger logger = new ClientLogger(EnvironmentCredential.class); /** * Creates an instance of the default environment credential provider. * * ...
Thoughts on changing the `containsAll` method to `getAll`? There are already some race condition chances going on with validating existence then retrieval, if we retrieval all into local instances we could reduce the number of timing issues happening.
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.fromSupplier(() -> { if (configuration.containsAll(Configuration.PROPERTY_AZURE_TENANT_ID, Configuration.PROPERTY_AZURE_CLIENT_ID, Configuration.PROPERTY_AZURE_CLIENT_SECRET)) { return new ClientSecretCredential(configuration.get(Configuration...
if (configuration.containsAll(Configuration.PROPERTY_AZURE_TENANT_ID,
public Mono<AccessToken> getToken(TokenRequestContext request) { String clientId = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_ID); String tenantId = configuration.get(Configuration.PROPERTY_AZURE_TENANT_ID); String clientSecret = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_SECRET); String certPath ...
class EnvironmentCredential implements TokenCredential { private final Configuration configuration; private final IdentityClientOptions identityClientOptions; private final ClientLogger logger = new ClientLogger(EnvironmentCredential.class); /** * Creates an instance of the default environment credential provider. * * ...
class EnvironmentCredential implements TokenCredential { private final Configuration configuration; private final IdentityClientOptions identityClientOptions; private final ClientLogger logger = new ClientLogger(EnvironmentCredential.class); /** * Creates an instance of the default environment credential provider. * * ...
Could we retrieve the commonly needed configuration and check those first? Seems like we could make an initial check that `PROPERTY_AZURE_CLIENT_ID` is set and if not just early out.
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.fromSupplier(() -> { if (configuration.containsAll(Configuration.PROPERTY_AZURE_TENANT_ID, Configuration.PROPERTY_AZURE_CLIENT_ID, Configuration.PROPERTY_AZURE_CLIENT_SECRET)) { return new ClientSecretCredential(configuration.get(Configuration...
return new UsernamePasswordCredential(configuration.get(Configuration.PROPERTY_AZURE_CLIENT_ID),
public Mono<AccessToken> getToken(TokenRequestContext request) { String clientId = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_ID); String tenantId = configuration.get(Configuration.PROPERTY_AZURE_TENANT_ID); String clientSecret = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_SECRET); String certPath ...
class EnvironmentCredential implements TokenCredential { private final Configuration configuration; private final IdentityClientOptions identityClientOptions; private final ClientLogger logger = new ClientLogger(EnvironmentCredential.class); /** * Creates an instance of the default environment credential provider. * * ...
class EnvironmentCredential implements TokenCredential { private final Configuration configuration; private final IdentityClientOptions identityClientOptions; private final ClientLogger logger = new ClientLogger(EnvironmentCredential.class); /** * Creates an instance of the default environment credential provider. * * ...
Could remove the local instance since `Configuration` uses the fluent pattern for `put`.
public void testCreateEnvironmentClientCertificateCredential() { Configuration configuration = Configuration.getGlobalConfiguration(); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo"); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_CERTIFICATE_PATH, "bar"); configuration.put(Configuration.PROPERT...
Configuration configuration = Configuration.getGlobalConfiguration();
public void testCreateEnvironmentClientCertificateCredential() { Configuration.getGlobalConfiguration() .put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo") .put(Configuration.PROPERTY_AZURE_USERNAME, "bar") .put(Configuration.PROPERTY_AZURE_PASSWORD, "baz"); EnvironmentCredential credential = new EnvironmentCredentialB...
class EnvironmentCredentialTests { @Test public void testCreateEnvironmentClientSecretCredential() { Configuration configuration = Configuration.getGlobalConfiguration(); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo"); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_SECRET, "bar"); configuration...
class EnvironmentCredentialTests { @Test public void testCreateEnvironmentClientSecretCredential() { Configuration.getGlobalConfiguration() .put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo") .put(Configuration.PROPERTY_AZURE_USERNAME, "bar") .put(Configuration.PROPERTY_AZURE_PASSWORD, "baz"); EnvironmentCredential cre...
Same as the previous comment
public void testCreateEnvironmentUserPasswordCredential() { Configuration configuration = Configuration.getGlobalConfiguration(); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo"); configuration.put(Configuration.PROPERTY_AZURE_USERNAME, "bar"); configuration.put(Configuration.PROPERTY_AZURE_PASSWORD, "b...
Configuration configuration = Configuration.getGlobalConfiguration();
public void testCreateEnvironmentUserPasswordCredential() { Configuration.getGlobalConfiguration() .put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo") .put(Configuration.PROPERTY_AZURE_USERNAME, "bar") .put(Configuration.PROPERTY_AZURE_PASSWORD, "baz"); EnvironmentCredential credential = new EnvironmentCredentialBuilde...
class EnvironmentCredentialTests { @Test public void testCreateEnvironmentClientSecretCredential() { Configuration configuration = Configuration.getGlobalConfiguration(); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo"); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_SECRET, "bar"); configuration...
class EnvironmentCredentialTests { @Test public void testCreateEnvironmentClientSecretCredential() { Configuration.getGlobalConfiguration() .put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo") .put(Configuration.PROPERTY_AZURE_USERNAME, "bar") .put(Configuration.PROPERTY_AZURE_PASSWORD, "baz"); EnvironmentCredential cre...
NIT: I think this comment should say "ClientCertificateCredential" instead of "ClientSecretCredential"
public void testCreateEnvironmentClientCertificateCredential() { Configuration configuration = Configuration.getGlobalConfiguration(); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo"); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_CERTIFICATE_PATH, "bar"); configuration.put(Configuration.PROPERT...
public void testCreateEnvironmentClientCertificateCredential() { Configuration.getGlobalConfiguration() .put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo") .put(Configuration.PROPERTY_AZURE_USERNAME, "bar") .put(Configuration.PROPERTY_AZURE_PASSWORD, "baz"); EnvironmentCredential credential = new EnvironmentCredentialB...
class EnvironmentCredentialTests { @Test public void testCreateEnvironmentClientSecretCredential() { Configuration configuration = Configuration.getGlobalConfiguration(); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo"); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_SECRET, "bar"); configuration...
class EnvironmentCredentialTests { @Test public void testCreateEnvironmentClientSecretCredential() { Configuration.getGlobalConfiguration() .put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo") .put(Configuration.PROPERTY_AZURE_USERNAME, "bar") .put(Configuration.PROPERTY_AZURE_PASSWORD, "baz"); EnvironmentCredential cre...
NIT: Similar feedback as above, I think this should be UsernamePasswordCredential in the comment.
public void testCreateEnvironmentUserPasswordCredential() { Configuration configuration = Configuration.getGlobalConfiguration(); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo"); configuration.put(Configuration.PROPERTY_AZURE_USERNAME, "bar"); configuration.put(Configuration.PROPERTY_AZURE_PASSWORD, "b...
public void testCreateEnvironmentUserPasswordCredential() { Configuration.getGlobalConfiguration() .put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo") .put(Configuration.PROPERTY_AZURE_USERNAME, "bar") .put(Configuration.PROPERTY_AZURE_PASSWORD, "baz"); EnvironmentCredential credential = new EnvironmentCredentialBuilde...
class EnvironmentCredentialTests { @Test public void testCreateEnvironmentClientSecretCredential() { Configuration configuration = Configuration.getGlobalConfiguration(); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo"); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_SECRET, "bar"); configuration...
class EnvironmentCredentialTests { @Test public void testCreateEnvironmentClientSecretCredential() { Configuration.getGlobalConfiguration() .put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo") .put(Configuration.PROPERTY_AZURE_USERNAME, "bar") .put(Configuration.PROPERTY_AZURE_PASSWORD, "baz"); EnvironmentCredential cre...
No it's not, but supply it anyway (`null` if not set, or a tenant id if set).
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.fromSupplier(() -> { if (configuration.containsAll(Configuration.PROPERTY_AZURE_TENANT_ID, Configuration.PROPERTY_AZURE_CLIENT_ID, Configuration.PROPERTY_AZURE_CLIENT_SECRET)) { return new ClientSecretCredential(configuration.get(Configuration...
configuration.get(Configuration.PROPERTY_AZURE_TENANT_ID),
public Mono<AccessToken> getToken(TokenRequestContext request) { String clientId = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_ID); String tenantId = configuration.get(Configuration.PROPERTY_AZURE_TENANT_ID); String clientSecret = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_SECRET); String certPath ...
class EnvironmentCredential implements TokenCredential { private final Configuration configuration; private final IdentityClientOptions identityClientOptions; private final ClientLogger logger = new ClientLogger(EnvironmentCredential.class); /** * Creates an instance of the default environment credential provider. * * ...
class EnvironmentCredential implements TokenCredential { private final Configuration configuration; private final IdentityClientOptions identityClientOptions; private final ClientLogger logger = new ClientLogger(EnvironmentCredential.class); /** * Creates an instance of the default environment credential provider. * * ...
Will error level enabled check come later?
public void readMyWrites(boolean useNameLink) throws Exception { int concurrency = 5; String cmdFormat = "-serviceEndpoint %s -masterKey %s" + " -databaseId %s" + " -collectionId %s" + " -consistencyLevel %s" + " -concurrency %s" + " -numberOfOperations %s" + " -maxRunningTimeDuration %s" + " -operation ReadMyWrites" +...
logger.error("Error occurred in ReadMyWriteWorkflow", throwable);
public void readMyWrites(boolean useNameLink) throws Exception { int concurrency = 5; String cmdFormat = "-serviceEndpoint %s -masterKey %s" + " -databaseId %s" + " -collectionId %s" + " -consistencyLevel %s" + " -concurrency %s" + " -numberOfOperations %s" + " -maxRunningTimeDuration %s" + " -operation ReadMyWrites" +...
class ReadMyWritesConsistencyTest { private final static Logger logger = LoggerFactory.getLogger(ReadMyWritesConsistencyTest.class); private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); private final Duration defaultMaxRunningTime = Duration.ofMinutes(45); private final int delayForInitiation...
class ReadMyWritesConsistencyTest { private final static Logger logger = LoggerFactory.getLogger(ReadMyWritesConsistencyTest.class); private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); private final Duration defaultMaxRunningTime = Duration.ofMinutes(45); private final int delayForInitiation...
Since this is logging error in tests, I don't think if we need error level enabled check for this. This is only for debugging CI
public void readMyWrites(boolean useNameLink) throws Exception { int concurrency = 5; String cmdFormat = "-serviceEndpoint %s -masterKey %s" + " -databaseId %s" + " -collectionId %s" + " -consistencyLevel %s" + " -concurrency %s" + " -numberOfOperations %s" + " -maxRunningTimeDuration %s" + " -operation ReadMyWrites" +...
logger.error("Error occurred in ReadMyWriteWorkflow", throwable);
public void readMyWrites(boolean useNameLink) throws Exception { int concurrency = 5; String cmdFormat = "-serviceEndpoint %s -masterKey %s" + " -databaseId %s" + " -collectionId %s" + " -consistencyLevel %s" + " -concurrency %s" + " -numberOfOperations %s" + " -maxRunningTimeDuration %s" + " -operation ReadMyWrites" +...
class ReadMyWritesConsistencyTest { private final static Logger logger = LoggerFactory.getLogger(ReadMyWritesConsistencyTest.class); private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); private final Duration defaultMaxRunningTime = Duration.ofMinutes(45); private final int delayForInitiation...
class ReadMyWritesConsistencyTest { private final static Logger logger = LoggerFactory.getLogger(ReadMyWritesConsistencyTest.class); private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); private final Duration defaultMaxRunningTime = Duration.ofMinutes(45); private final int delayForInitiation...
slf4j internally will check the log level, so checking log level is not needed in this case. checking log level is needed only when the information needed to be logged requires some pre-computation. For example in the following case checking log level helps: ```java // checking log level helps if (logger.isDebugEnabl...
public void readMyWrites(boolean useNameLink) throws Exception { int concurrency = 5; String cmdFormat = "-serviceEndpoint %s -masterKey %s" + " -databaseId %s" + " -collectionId %s" + " -consistencyLevel %s" + " -concurrency %s" + " -numberOfOperations %s" + " -maxRunningTimeDuration %s" + " -operation ReadMyWrites" +...
logger.error("Error occurred in ReadMyWriteWorkflow", throwable);
public void readMyWrites(boolean useNameLink) throws Exception { int concurrency = 5; String cmdFormat = "-serviceEndpoint %s -masterKey %s" + " -databaseId %s" + " -collectionId %s" + " -consistencyLevel %s" + " -concurrency %s" + " -numberOfOperations %s" + " -maxRunningTimeDuration %s" + " -operation ReadMyWrites" +...
class ReadMyWritesConsistencyTest { private final static Logger logger = LoggerFactory.getLogger(ReadMyWritesConsistencyTest.class); private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); private final Duration defaultMaxRunningTime = Duration.ofMinutes(45); private final int delayForInitiation...
class ReadMyWritesConsistencyTest { private final static Logger logger = LoggerFactory.getLogger(ReadMyWritesConsistencyTest.class); private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); private final Duration defaultMaxRunningTime = Duration.ofMinutes(45); private final int delayForInitiation...
Agreed, thanks for the reference @moderakh
public void readMyWrites(boolean useNameLink) throws Exception { int concurrency = 5; String cmdFormat = "-serviceEndpoint %s -masterKey %s" + " -databaseId %s" + " -collectionId %s" + " -consistencyLevel %s" + " -concurrency %s" + " -numberOfOperations %s" + " -maxRunningTimeDuration %s" + " -operation ReadMyWrites" +...
logger.error("Error occurred in ReadMyWriteWorkflow", throwable);
public void readMyWrites(boolean useNameLink) throws Exception { int concurrency = 5; String cmdFormat = "-serviceEndpoint %s -masterKey %s" + " -databaseId %s" + " -collectionId %s" + " -consistencyLevel %s" + " -concurrency %s" + " -numberOfOperations %s" + " -maxRunningTimeDuration %s" + " -operation ReadMyWrites" +...
class ReadMyWritesConsistencyTest { private final static Logger logger = LoggerFactory.getLogger(ReadMyWritesConsistencyTest.class); private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); private final Duration defaultMaxRunningTime = Duration.ofMinutes(45); private final int delayForInitiation...
class ReadMyWritesConsistencyTest { private final static Logger logger = LoggerFactory.getLogger(ReadMyWritesConsistencyTest.class); private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); private final Duration defaultMaxRunningTime = Duration.ofMinutes(45); private final int delayForInitiation...
Can we use `Locale.ROOT` instead or does it have to be in US locale?
private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX", Locale.US); DateTimeFormatter dtf_windows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX", Locale.US); try { return Lo...
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX", Locale.US);
private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX"); DateTimeFormatter dtfWindows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX"); try { return Long.parseLong(dateTime);...
class MSIToken extends AccessToken { private static final OffsetDateTime EPOCH = OffsetDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); @JsonProperty(value = "token_type") private String tokenType; @JsonProperty(value = "access_token") private String accessToken; @JsonProperty(value = "expires_on") private String e...
class MSIToken extends AccessToken { private static final OffsetDateTime EPOCH = OffsetDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); @JsonProperty(value = "token_type") private String tokenType; @JsonProperty(value = "access_token") private String accessToken; @JsonProperty(value = "expires_on") private String e...
```suggestion DateTimeFormatter dtfWindows= DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX", Locale.US); ```
private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX", Locale.US); DateTimeFormatter dtf_windows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX", Locale.US); try { return Lo...
DateTimeFormatter dtf_windows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX", Locale.US);
private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX"); DateTimeFormatter dtfWindows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX"); try { return Long.parseLong(dateTime);...
class MSIToken extends AccessToken { private static final OffsetDateTime EPOCH = OffsetDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); @JsonProperty(value = "token_type") private String tokenType; @JsonProperty(value = "access_token") private String accessToken; @JsonProperty(value = "expires_on") private String e...
class MSIToken extends AccessToken { private static final OffsetDateTime EPOCH = OffsetDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); @JsonProperty(value = "token_type") private String tokenType; @JsonProperty(value = "access_token") private String accessToken; @JsonProperty(value = "expires_on") private String e...
I was thinking the service would always send US formatted datetimes, but i'm not sure
private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX", Locale.US); DateTimeFormatter dtf_windows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX", Locale.US); try { return Lo...
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX", Locale.US);
private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX"); DateTimeFormatter dtfWindows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX"); try { return Long.parseLong(dateTime);...
class MSIToken extends AccessToken { private static final OffsetDateTime EPOCH = OffsetDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); @JsonProperty(value = "token_type") private String tokenType; @JsonProperty(value = "access_token") private String accessToken; @JsonProperty(value = "expires_on") private String e...
class MSIToken extends AccessToken { private static final OffsetDateTime EPOCH = OffsetDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); @JsonProperty(value = "token_type") private String tokenType; @JsonProperty(value = "access_token") private String accessToken; @JsonProperty(value = "expires_on") private String e...
changed back to default which was working before
private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX", Locale.US); DateTimeFormatter dtf_windows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX", Locale.US); try { return Lo...
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX", Locale.US);
private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX"); DateTimeFormatter dtfWindows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX"); try { return Long.parseLong(dateTime);...
class MSIToken extends AccessToken { private static final OffsetDateTime EPOCH = OffsetDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); @JsonProperty(value = "token_type") private String tokenType; @JsonProperty(value = "access_token") private String accessToken; @JsonProperty(value = "expires_on") private String e...
class MSIToken extends AccessToken { private static final OffsetDateTime EPOCH = OffsetDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); @JsonProperty(value = "token_type") private String tokenType; @JsonProperty(value = "access_token") private String accessToken; @JsonProperty(value = "expires_on") private String e...
for the .block(), should we pass in the "retryOptions.operationTimeout" so it doesn't block forever (or I think default is 5 mins)?
public void updateCheckpoint() { this.updateCheckpointAsync().block(); }
this.updateCheckpointAsync().block();
public void updateCheckpoint() { this.updateCheckpointAsync().block(); }
class EventContext { private final PartitionContext partitionContext; private final EventData eventData; private final CheckpointStore checkpointStore; private final LastEnqueuedEventProperties lastEnqueuedEventProperties; /** * Creates an instance of {@link EventContext}. * * @param partitionContext The partition info...
class EventContext { private final PartitionContext partitionContext; private final EventData eventData; private final CheckpointStore checkpointStore; private final LastEnqueuedEventProperties lastEnqueuedEventProperties; /** * Creates an instance of {@link EventContext}. * * @param partitionContext The partition info...
Since this is just a delegate method to the checkpoint store's updateCheckpoint(), I think the checkpoint store (blob client or any other store) should be configured with the necessary timeouts and retry options. If the store they use is super-slow, they might want a different timeout setting than the one they use for ...
public void updateCheckpoint() { this.updateCheckpointAsync().block(); }
this.updateCheckpointAsync().block();
public void updateCheckpoint() { this.updateCheckpointAsync().block(); }
class EventContext { private final PartitionContext partitionContext; private final EventData eventData; private final CheckpointStore checkpointStore; private final LastEnqueuedEventProperties lastEnqueuedEventProperties; /** * Creates an instance of {@link EventContext}. * * @param partitionContext The partition info...
class EventContext { private final PartitionContext partitionContext; private final EventData eventData; private final CheckpointStore checkpointStore; private final LastEnqueuedEventProperties lastEnqueuedEventProperties; /** * Creates an instance of {@link EventContext}. * * @param partitionContext The partition info...
can't we assume that the second param is always partition key? that way the caller doesn't have to explicitly wrap pk value in PartitionKey and implementation will take care of that. thoughts?
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { int index = (int) (i % docsToRead.size()); PojoizedJson doc = docsToRead.get(index); String partitionKeyValue = doc.getId(); Mono<CosmosAsyncItemResponse<PojoizedJson>> result = cosmosAsyncContai...
new PartitionKey(partitionKeyValue),
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { int index = (int) (i % docsToRead.size()); PojoizedJson doc = docsToRead.get(index); String partitionKeyValue = doc.getId(); Mono<CosmosAsyncItemResponse<PojoizedJson>> result = cosmosAsyncContai...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
we should pass partition key to CosmosItemRequestOption here. The intention of this benchmark is to measure perf when pk is passed as request options.
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { String partitionKey = uuid + i; Mono<CosmosAsyncItemResponse<PojoizedJson>> obs; if (configuration.isDisablePassingPartitionKeyAsOptionOnWrite()) { obs = cosmosAsyncContainer.createItem(generateD...
obs = cosmosAsyncContainer.createItem(generateDocument(partitionKey, dataFieldValue), new CosmosItemRequestOptions());
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { String partitionKey = uuid + i; Mono<CosmosAsyncItemResponse<PojoizedJson>> obs; if (configuration.isDisablePassingPartitionKeyAsOptionOnWrite()) { obs = cosmosAsyncContainer.createItem(generateD...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
this will result in double serialization (which was fixed prior to this PR)
public T getResource(){ return super.getProperties().toObject(itemClassType); }
return super.getProperties().toObject(itemClassType);
public T getResource(){ return Utils.parse(responseBodyString, itemClassType); }
class CosmosAsyncItemResponse<T> extends CosmosResponse<CosmosItemProperties> { private final Class<T> itemClassType; CosmosAsyncItemResponse(ResourceResponse<Document> response, Class<T> klass) { super(response); this.itemClassType = klass; String bodyAsString = response.getBodyAsString(); if (StringUtils.isEmpty(body...
class CosmosAsyncItemResponse<T> extends CosmosResponse<CosmosItemProperties> { private final Class<T> itemClassType; private final String responseBodyString; CosmosAsyncItemResponse(ResourceResponse<Document> response, Class<T> klass) { super(response); this.itemClassType = klass; responseBodyString = response.getBody...
We are following the .net model of making partitionkey object manadatory. https://github.com/Azure/azure-cosmos-dotnet-v3/blob/8f1375a30799b3acf95d843b2db0c2447cbc3876/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs#L476
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { int index = (int) (i % docsToRead.size()); PojoizedJson doc = docsToRead.get(index); String partitionKeyValue = doc.getId(); Mono<CosmosAsyncItemResponse<PojoizedJson>> result = cosmosAsyncContai...
new PartitionKey(partitionKeyValue),
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { int index = (int) (i % docsToRead.size()); PojoizedJson doc = docsToRead.get(index); String partitionKeyValue = doc.getId(); Mono<CosmosAsyncItemResponse<PojoizedJson>> result = cosmosAsyncContai...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
Changed this to avoid double serialization. Now we directly use the resource string to convert to user object.
public T getResource(){ return super.getProperties().toObject(itemClassType); }
return super.getProperties().toObject(itemClassType);
public T getResource(){ return Utils.parse(responseBodyString, itemClassType); }
class CosmosAsyncItemResponse<T> extends CosmosResponse<CosmosItemProperties> { private final Class<T> itemClassType; CosmosAsyncItemResponse(ResourceResponse<Document> response, Class<T> klass) { super(response); this.itemClassType = klass; String bodyAsString = response.getBodyAsString(); if (StringUtils.isEmpty(body...
class CosmosAsyncItemResponse<T> extends CosmosResponse<CosmosItemProperties> { private final Class<T> itemClassType; private final String responseBodyString; CosmosAsyncItemResponse(ResourceResponse<Document> response, Class<T> klass) { super(response); this.itemClassType = klass; responseBodyString = response.getBody...
Added new API accept partition key and changed this call accordingly.
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { String partitionKey = uuid + i; Mono<CosmosAsyncItemResponse<PojoizedJson>> obs; if (configuration.isDisablePassingPartitionKeyAsOptionOnWrite()) { obs = cosmosAsyncContainer.createItem(generateD...
obs = cosmosAsyncContainer.createItem(generateDocument(partitionKey, dataFieldValue), new CosmosItemRequestOptions());
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { String partitionKey = uuid + i; Mono<CosmosAsyncItemResponse<PojoizedJson>> obs; if (configuration.isDisablePassingPartitionKeyAsOptionOnWrite()) { obs = cosmosAsyncContainer.createItem(generateD...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
ok thanks
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { int index = (int) (i % docsToRead.size()); PojoizedJson doc = docsToRead.get(index); String partitionKeyValue = doc.getId(); Mono<CosmosAsyncItemResponse<PojoizedJson>> result = cosmosAsyncContai...
new PartitionKey(partitionKeyValue),
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { int index = (int) (i % docsToRead.size()); PojoizedJson doc = docsToRead.get(index); String partitionKeyValue = doc.getId(); Mono<CosmosAsyncItemResponse<PojoizedJson>> result = cosmosAsyncContai...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
Since `responseBodyString` can be empty string, can we please make sure it is handled well when parsing it to an `itemClassType` ? Do we want to throw error in that case, or return null ?
public T getResource(){ return Utils.parse(responseBodyString, itemClassType); }
return Utils.parse(responseBodyString, itemClassType);
public T getResource(){ return Utils.parse(responseBodyString, itemClassType); }
class CosmosAsyncItemResponse<T> extends CosmosResponse<CosmosItemProperties> { private final Class<T> itemClassType; private final String responseBodyString; CosmosAsyncItemResponse(ResourceResponse<Document> response, Class<T> klass) { super(response); this.itemClassType = klass; responseBodyString = response.getBody...
class CosmosAsyncItemResponse<T> extends CosmosResponse<CosmosItemProperties> { private final Class<T> itemClassType; private final String responseBodyString; CosmosAsyncItemResponse(ResourceResponse<Document> response, Class<T> klass) { super(response); this.itemClassType = klass; responseBodyString = response.getBody...
seems CosmosItemRequestOptions is redundant now. isn't there an overload which doesn't require `CosmosItemRequestOptions` if so we should use that one.
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { String partitionKey = uuid + i; Mono<CosmosAsyncItemResponse<PojoizedJson>> obs; if (configuration.isDisablePassingPartitionKeyAsOptionOnWrite()) { obs = cosmosAsyncContainer.createItem(generateD...
new CosmosItemRequestOptions());
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { String partitionKey = uuid + i; Mono<CosmosAsyncItemResponse<PojoizedJson>> obs; if (configuration.isDisablePassingPartitionKeyAsOptionOnWrite()) { obs = cosmosAsyncContainer.createItem(generateD...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
Handled the null/empty case. Returning null
public T getResource(){ return Utils.parse(responseBodyString, itemClassType); }
return Utils.parse(responseBodyString, itemClassType);
public T getResource(){ return Utils.parse(responseBodyString, itemClassType); }
class CosmosAsyncItemResponse<T> extends CosmosResponse<CosmosItemProperties> { private final Class<T> itemClassType; private final String responseBodyString; CosmosAsyncItemResponse(ResourceResponse<Document> response, Class<T> klass) { super(response); this.itemClassType = klass; responseBodyString = response.getBody...
class CosmosAsyncItemResponse<T> extends CosmosResponse<CosmosItemProperties> { private final Class<T> itemClassType; private final String responseBodyString; CosmosAsyncItemResponse(ResourceResponse<Document> response, Class<T> klass) { super(response); this.itemClassType = klass; responseBodyString = response.getBody...
We don't have an overload matching that. Will add if required in next PR.
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { String partitionKey = uuid + i; Mono<CosmosAsyncItemResponse<PojoizedJson>> obs; if (configuration.isDisablePassingPartitionKeyAsOptionOnWrite()) { obs = cosmosAsyncContainer.createItem(generateD...
new CosmosItemRequestOptions());
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { String partitionKey = uuid + i; Mono<CosmosAsyncItemResponse<PojoizedJson>> obs; if (configuration.isDisablePassingPartitionKeyAsOptionOnWrite()) { obs = cosmosAsyncContainer.createItem(generateD...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
class LatencySubscriber<T> extends BaseSubscriber<T> { Timer.Context context; BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber; LatencySubscriber(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber) { this.baseSubscriber = baseSubscriber; } @Override protected void hookOnSubscribe(Subscription subscription) { ...
What is a "type" supposed to be?
public String type() { return null; }
return null;
public String type() { return null; }
class AzureFileStore extends FileStore { private final AzureFileSystem parentFileSystem; private final BlobContainerClient containerClient; AzureFileStore(AzureFileSystem parentFileSystem, String containerName) throws IOException { if (Objects.isNull(parentFileSystem)) { throw new IllegalStateException("AzureFileStore ...
class AzureFileStore extends FileStore { private final ClientLogger logger = new ClientLogger(AzureFileStore.class); private final AzureFileSystem parentFileSystem; private final BlobContainerClient containerClient; AzureFileStore(AzureFileSystem parentFileSystem, String containerName) throws IOException { if (Objects....
Is it better to return -1 to be extremely obvious that we don't care about these numbers instead of accidentally implying there's no space or something like that?
public long getUnallocatedSpace() throws IOException { return 0; }
}
public long getUnallocatedSpace() throws IOException { return 0; }
class AzureFileStore extends FileStore { private final AzureFileSystem parentFileSystem; private final BlobContainerClient containerClient; AzureFileStore(AzureFileSystem parentFileSystem, String containerName) throws IOException { if (Objects.isNull(parentFileSystem)) { throw new IllegalStateException("AzureFileStore ...
class AzureFileStore extends FileStore { private final ClientLogger logger = new ClientLogger(AzureFileStore.class); private final AzureFileSystem parentFileSystem; private final BlobContainerClient containerClient; AzureFileStore(AzureFileSystem parentFileSystem, String containerName) throws IOException { if (Objects....
Updated PR description to note this API is not implemented yet and does not need to be reviewed.
public String type() { return null; }
return null;
public String type() { return null; }
class AzureFileStore extends FileStore { private final AzureFileSystem parentFileSystem; private final BlobContainerClient containerClient; AzureFileStore(AzureFileSystem parentFileSystem, String containerName) throws IOException { if (Objects.isNull(parentFileSystem)) { throw new IllegalStateException("AzureFileStore ...
class AzureFileStore extends FileStore { private final ClientLogger logger = new ClientLogger(AzureFileStore.class); private final AzureFileSystem parentFileSystem; private final BlobContainerClient containerClient; AzureFileStore(AzureFileSystem parentFileSystem, String containerName) throws IOException { if (Objects....
Updated PR description to note this API is not implemented yet and does not need to be reviewed.
public long getUnallocatedSpace() throws IOException { return 0; }
}
public long getUnallocatedSpace() throws IOException { return 0; }
class AzureFileStore extends FileStore { private final AzureFileSystem parentFileSystem; private final BlobContainerClient containerClient; AzureFileStore(AzureFileSystem parentFileSystem, String containerName) throws IOException { if (Objects.isNull(parentFileSystem)) { throw new IllegalStateException("AzureFileStore ...
class AzureFileStore extends FileStore { private final ClientLogger logger = new ClientLogger(AzureFileStore.class); private final AzureFileSystem parentFileSystem; private final BlobContainerClient containerClient; AzureFileStore(AzureFileSystem parentFileSystem, String containerName) throws IOException { if (Objects....
Do we want to make this a constant somewhere?
public String getScheme() { return "azb"; }
return "azb";
public String getScheme() { return "azb"; }
class AzureFileSystemProvider extends FileSystemProvider { private static final String ACCOUNT_QUERY_KEY = "account"; private ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public AzureFileSystemProvider() { this.openFileSystems = new ConcurrentHashMap<>(); } /** * Retur...
class AzureFileSystemProvider extends FileSystemProvider { private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class); private static final String ACCOUNT_QUERY_KEY = "account"; private final ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public ...
extra new line
public Iterable<FileStore> getFileStores() { return this.fileStores.values(); }
this.fileStores.values();
public Iterable<FileStore> getFileStores() { return this.fileStores.values(); }
class AzureFileSystem extends FileSystem { public static final String AZURE_STORAGE_ACCOUNT_KEY = "AzureStorageAccountKey"; public static final String AZURE_STORAGE_SAS_TOKEN = "AzureStorageSasToken"; public static final String AZURE_STORAGE_HTTP_LOG_DETAIL_LEVEL = "AzureStorageHttpLogDetailLevel"; public static final ...
class AzureFileSystem extends FileSystem { private final ClientLogger logger = new ClientLogger(AzureFileSystem.class); /** * Expected type: String */ public static final String AZURE_STORAGE_ACCOUNT_KEY = "AzureStorageAccountKey"; /** * Expected type: String */ public static final String AZURE_STORAGE_SAS_TOKEN = "Azu...
This should use `BlobServiceClientBuilder.getDefaultHttpLopOptions()` as the base before setting the log level, this will continue to maintain proper query string and header logging. Right now this would wipe out all Storage specific headers and query string parameters from being logged. Future enhancement would be ad...
private BlobServiceClient buildBlobServiceClient(String accountName, Map<String,?> config) { String scheme = !config.containsKey(AZURE_STORAGE_USE_HTTPS) || (Boolean) config.get(AZURE_STORAGE_USE_HTTPS) ? "https" : "http"; BlobServiceClientBuilder builder = new BlobServiceClientBuilder() .endpoint(String.format(AZURE_S...
.setLogLevel((HttpLogDetailLevel)config.get(AZURE_STORAGE_HTTP_LOG_DETAIL_LEVEL)));
private BlobServiceClient buildBlobServiceClient(String accountName, Map<String,?> config) { String scheme = !config.containsKey(AZURE_STORAGE_USE_HTTPS) || (Boolean) config.get(AZURE_STORAGE_USE_HTTPS) ? "https" : "http"; BlobServiceClientBuilder builder = new BlobServiceClientBuilder() .endpoint(String.format(AZURE_S...
class AzureFileSystem extends FileSystem { public static final String AZURE_STORAGE_ACCOUNT_KEY = "AzureStorageAccountKey"; public static final String AZURE_STORAGE_SAS_TOKEN = "AzureStorageSasToken"; public static final String AZURE_STORAGE_HTTP_LOG_DETAIL_LEVEL = "AzureStorageHttpLogDetailLevel"; public static final ...
class AzureFileSystem extends FileSystem { private final ClientLogger logger = new ClientLogger(AzureFileSystem.class); /** * Expected type: String */ public static final String AZURE_STORAGE_ACCOUNT_KEY = "AzureStorageAccountKey"; /** * Expected type: String */ public static final String AZURE_STORAGE_SAS_TOKEN = "Azu...
Should we add the already existing FileSystem name into the exception?
public FileSystem newFileSystem(URI uri, Map<String, ?> config) throws IOException { String accountName = extractAccountName(uri); if (this.openFileSystems.containsKey(accountName)) { throw new FileSystemAlreadyExistsException(); } AzureFileSystem afs = new AzureFileSystem(this, accountName, config); this.openFileSyste...
throw new FileSystemAlreadyExistsException();
public FileSystem newFileSystem(URI uri, Map<String, ?> config) throws IOException { String accountName = extractAccountName(uri); if (this.openFileSystems.containsKey(accountName)) { throw Utility.logError(this.logger, new FileSystemAlreadyExistsException("Name: " + accountName)); } AzureFileSystem afs = new AzureFile...
class AzureFileSystemProvider extends FileSystemProvider { private static final String ACCOUNT_QUERY_KEY = "account"; private ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public AzureFileSystemProvider() { this.openFileSystems = new ConcurrentHashMap<>(); } /** * Retur...
class AzureFileSystemProvider extends FileSystemProvider { private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class); private static final String ACCOUNT_QUERY_KEY = "account"; private final ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public ...
Should the name of the FileSystem be included in this message? Would help troubleshooting issues.
public FileSystem getFileSystem(URI uri) { String accountName = extractAccountName(uri); if (!this.openFileSystems.containsKey(accountName)) { throw new FileSystemNotFoundException(); } return this.openFileSystems.get(accountName); }
throw new FileSystemNotFoundException();
public FileSystem getFileSystem(URI uri) { String accountName = extractAccountName(uri); if (!this.openFileSystems.containsKey(accountName)) { throw Utility.logError(this.logger, new FileSystemNotFoundException("Name: " + accountName)); } return this.openFileSystems.get(accountName); }
class AzureFileSystemProvider extends FileSystemProvider { private static final String ACCOUNT_QUERY_KEY = "account"; private ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public AzureFileSystemProvider() { this.openFileSystems = new ConcurrentHashMap<>(); } /** * Retur...
class AzureFileSystemProvider extends FileSystemProvider { private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class); private static final String ACCOUNT_QUERY_KEY = "account"; private final ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public ...
I can make it a constant if you would prefer, but it feels a little redundant. I only anticipate other code calling into the provider to get the scheme when necessary, so all code would go through this method and the constant would only be returned from this method.
public String getScheme() { return "azb"; }
return "azb";
public String getScheme() { return "azb"; }
class AzureFileSystemProvider extends FileSystemProvider { private static final String ACCOUNT_QUERY_KEY = "account"; private ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public AzureFileSystemProvider() { this.openFileSystems = new ConcurrentHashMap<>(); } /** * Retur...
class AzureFileSystemProvider extends FileSystemProvider { private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class); private static final String ACCOUNT_QUERY_KEY = "account"; private final ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public ...
Thanks for catching this. Yea I felt like those parameters were a bit overkill for an initial release and that it would be easy to add them later.
private BlobServiceClient buildBlobServiceClient(String accountName, Map<String,?> config) { String scheme = !config.containsKey(AZURE_STORAGE_USE_HTTPS) || (Boolean) config.get(AZURE_STORAGE_USE_HTTPS) ? "https" : "http"; BlobServiceClientBuilder builder = new BlobServiceClientBuilder() .endpoint(String.format(AZURE_S...
.setLogLevel((HttpLogDetailLevel)config.get(AZURE_STORAGE_HTTP_LOG_DETAIL_LEVEL)));
private BlobServiceClient buildBlobServiceClient(String accountName, Map<String,?> config) { String scheme = !config.containsKey(AZURE_STORAGE_USE_HTTPS) || (Boolean) config.get(AZURE_STORAGE_USE_HTTPS) ? "https" : "http"; BlobServiceClientBuilder builder = new BlobServiceClientBuilder() .endpoint(String.format(AZURE_S...
class AzureFileSystem extends FileSystem { public static final String AZURE_STORAGE_ACCOUNT_KEY = "AzureStorageAccountKey"; public static final String AZURE_STORAGE_SAS_TOKEN = "AzureStorageSasToken"; public static final String AZURE_STORAGE_HTTP_LOG_DETAIL_LEVEL = "AzureStorageHttpLogDetailLevel"; public static final ...
class AzureFileSystem extends FileSystem { private final ClientLogger logger = new ClientLogger(AzureFileSystem.class); /** * Expected type: String */ public static final String AZURE_STORAGE_ACCOUNT_KEY = "AzureStorageAccountKey"; /** * Expected type: String */ public static final String AZURE_STORAGE_SAS_TOKEN = "Azu...
Probably a good idea. I'll double check the docs, too.
public FileSystem newFileSystem(URI uri, Map<String, ?> config) throws IOException { String accountName = extractAccountName(uri); if (this.openFileSystems.containsKey(accountName)) { throw new FileSystemAlreadyExistsException(); } AzureFileSystem afs = new AzureFileSystem(this, accountName, config); this.openFileSyste...
throw new FileSystemAlreadyExistsException();
public FileSystem newFileSystem(URI uri, Map<String, ?> config) throws IOException { String accountName = extractAccountName(uri); if (this.openFileSystems.containsKey(accountName)) { throw Utility.logError(this.logger, new FileSystemAlreadyExistsException("Name: " + accountName)); } AzureFileSystem afs = new AzureFile...
class AzureFileSystemProvider extends FileSystemProvider { private static final String ACCOUNT_QUERY_KEY = "account"; private ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public AzureFileSystemProvider() { this.openFileSystems = new ConcurrentHashMap<>(); } /** * Retur...
class AzureFileSystemProvider extends FileSystemProvider { private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class); private static final String ACCOUNT_QUERY_KEY = "account"; private final ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public ...
Same as above.
public FileSystem getFileSystem(URI uri) { String accountName = extractAccountName(uri); if (!this.openFileSystems.containsKey(accountName)) { throw new FileSystemNotFoundException(); } return this.openFileSystems.get(accountName); }
throw new FileSystemNotFoundException();
public FileSystem getFileSystem(URI uri) { String accountName = extractAccountName(uri); if (!this.openFileSystems.containsKey(accountName)) { throw Utility.logError(this.logger, new FileSystemNotFoundException("Name: " + accountName)); } return this.openFileSystems.get(accountName); }
class AzureFileSystemProvider extends FileSystemProvider { private static final String ACCOUNT_QUERY_KEY = "account"; private ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public AzureFileSystemProvider() { this.openFileSystems = new ConcurrentHashMap<>(); } /** * Retur...
class AzureFileSystemProvider extends FileSystemProvider { private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class); private static final String ACCOUNT_QUERY_KEY = "account"; private final ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public ...
It's possible a user may want the constant when building their URI right?
public String getScheme() { return "azb"; }
return "azb";
public String getScheme() { return "azb"; }
class AzureFileSystemProvider extends FileSystemProvider { private static final String ACCOUNT_QUERY_KEY = "account"; private ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public AzureFileSystemProvider() { this.openFileSystems = new ConcurrentHashMap<>(); } /** * Retur...
class AzureFileSystemProvider extends FileSystemProvider { private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class); private static final String ACCOUNT_QUERY_KEY = "account"; private final ConcurrentMap<String, FileSystem> openFileSystems; /** * Creates an AzureFileSystemProvider. */ public ...
Agreed on the parameters not being needed during the initial preview.
private BlobServiceClient buildBlobServiceClient(String accountName, Map<String,?> config) { String scheme = !config.containsKey(AZURE_STORAGE_USE_HTTPS) || (Boolean) config.get(AZURE_STORAGE_USE_HTTPS) ? "https" : "http"; BlobServiceClientBuilder builder = new BlobServiceClientBuilder() .endpoint(String.format(AZURE_S...
.setLogLevel((HttpLogDetailLevel)config.get(AZURE_STORAGE_HTTP_LOG_DETAIL_LEVEL)));
private BlobServiceClient buildBlobServiceClient(String accountName, Map<String,?> config) { String scheme = !config.containsKey(AZURE_STORAGE_USE_HTTPS) || (Boolean) config.get(AZURE_STORAGE_USE_HTTPS) ? "https" : "http"; BlobServiceClientBuilder builder = new BlobServiceClientBuilder() .endpoint(String.format(AZURE_S...
class AzureFileSystem extends FileSystem { public static final String AZURE_STORAGE_ACCOUNT_KEY = "AzureStorageAccountKey"; public static final String AZURE_STORAGE_SAS_TOKEN = "AzureStorageSasToken"; public static final String AZURE_STORAGE_HTTP_LOG_DETAIL_LEVEL = "AzureStorageHttpLogDetailLevel"; public static final ...
class AzureFileSystem extends FileSystem { private final ClientLogger logger = new ClientLogger(AzureFileSystem.class); /** * Expected type: String */ public static final String AZURE_STORAGE_ACCOUNT_KEY = "AzureStorageAccountKey"; /** * Expected type: String */ public static final String AZURE_STORAGE_SAS_TOKEN = "Azu...
Why not use [Math.pow()](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#pow-double-double-) method instead of implementing own power method?
private static int Pow(int value, int exponent) { int power = 1; for (int i=0; i < exponent; i++) { power *= value; } return power; }
}
private static int Pow(int value, int exponent) { int power = 1; for (int i=0; i < exponent; i++) { power *= value; } return power; }
class SleepTest extends PerfStressTest<PerfStressOptions> { private static final AtomicInteger _instanceCount = new AtomicInteger(); private final int _secondsPerOperation; public SleepTest(PerfStressOptions options) { super(options); int instanceCount = _instanceCount.incrementAndGet(); _secondsPerOperation = Pow(2, i...
class SleepTest extends PerfStressTest<PerfStressOptions> { private static final AtomicInteger _instanceCount = new AtomicInteger(); private final int _secondsPerOperation; public SleepTest(PerfStressOptions options) { super(options); int instanceCount = _instanceCount.incrementAndGet(); _secondsPerOperation = Pow(2, i...
This case is interesting given that writing to the blob may be delayed a non-determinant amount of time, this differs from the other cases of `overwrite` where their write operation should happen relatively soon compared to the validation check.
public BlobOutputStream getBlobOutputStream(boolean overwrite) { BlobRequestConditions requestConditions = null; if (!overwrite) { if (exists()) { throw logger.logExceptionAsError(new IllegalArgumentException(Constants.BLOB_ALREADY_EXISTS)); } requestConditions = new BlobRequestConditions().setIfNoneMatch(Constants.Hea...
}
public BlobOutputStream getBlobOutputStream(boolean overwrite) { BlobRequestConditions requestConditions = null; if (!overwrite) { if (exists()) { throw logger.logExceptionAsError(new IllegalArgumentException(Constants.BLOB_ALREADY_EXISTS)); } requestConditions = new BlobRequestConditions().setIfNoneMatch(Constants.Hea...
class EncryptedBlobClient extends BlobClient { private final ClientLogger logger = new ClientLogger(EncryptedBlobClient.class); private final EncryptedBlobAsyncClient encryptedBlobAsyncClient; /** * Package-private constructor for use by {@link BlobClientBuilder}. */ EncryptedBlobClient(EncryptedBlobAsyncClient encrypt...
class EncryptedBlobClient extends BlobClient { private final ClientLogger logger = new ClientLogger(EncryptedBlobClient.class); private final EncryptedBlobAsyncClient encryptedBlobAsyncClient; /** * Package-private constructor for use by {@link BlobClientBuilder}. */ EncryptedBlobClient(EncryptedBlobAsyncClient encrypt...
This makes sense to me, the only other way would be to pass it in to the outputstream and it would fail upon closing - so that would be potentially annoying for the customer
public BlobOutputStream getBlobOutputStream(boolean overwrite) { BlobRequestConditions requestConditions = null; if (!overwrite) { if (exists()) { throw logger.logExceptionAsError(new IllegalArgumentException(Constants.BLOB_ALREADY_EXISTS)); } requestConditions = new BlobRequestConditions().setIfNoneMatch(Constants.Hea...
}
public BlobOutputStream getBlobOutputStream(boolean overwrite) { BlobRequestConditions requestConditions = null; if (!overwrite) { if (exists()) { throw logger.logExceptionAsError(new IllegalArgumentException(Constants.BLOB_ALREADY_EXISTS)); } requestConditions = new BlobRequestConditions().setIfNoneMatch(Constants.Hea...
class EncryptedBlobClient extends BlobClient { private final ClientLogger logger = new ClientLogger(EncryptedBlobClient.class); private final EncryptedBlobAsyncClient encryptedBlobAsyncClient; /** * Package-private constructor for use by {@link BlobClientBuilder}. */ EncryptedBlobClient(EncryptedBlobAsyncClient encrypt...
class EncryptedBlobClient extends BlobClient { private final ClientLogger logger = new ClientLogger(EncryptedBlobClient.class); private final EncryptedBlobAsyncClient encryptedBlobAsyncClient; /** * Package-private constructor for use by {@link BlobClientBuilder}. */ EncryptedBlobClient(EncryptedBlobAsyncClient encrypt...
Agreed, failing fast is the better option here.
public BlobOutputStream getBlobOutputStream(boolean overwrite) { BlobRequestConditions requestConditions = null; if (!overwrite) { if (exists()) { throw logger.logExceptionAsError(new IllegalArgumentException(Constants.BLOB_ALREADY_EXISTS)); } requestConditions = new BlobRequestConditions().setIfNoneMatch(Constants.Hea...
}
public BlobOutputStream getBlobOutputStream(boolean overwrite) { BlobRequestConditions requestConditions = null; if (!overwrite) { if (exists()) { throw logger.logExceptionAsError(new IllegalArgumentException(Constants.BLOB_ALREADY_EXISTS)); } requestConditions = new BlobRequestConditions().setIfNoneMatch(Constants.Hea...
class EncryptedBlobClient extends BlobClient { private final ClientLogger logger = new ClientLogger(EncryptedBlobClient.class); private final EncryptedBlobAsyncClient encryptedBlobAsyncClient; /** * Package-private constructor for use by {@link BlobClientBuilder}. */ EncryptedBlobClient(EncryptedBlobAsyncClient encrypt...
class EncryptedBlobClient extends BlobClient { private final ClientLogger logger = new ClientLogger(EncryptedBlobClient.class); private final EncryptedBlobAsyncClient encryptedBlobAsyncClient; /** * Package-private constructor for use by {@link BlobClientBuilder}. */ EncryptedBlobClient(EncryptedBlobAsyncClient encrypt...
Yeah, we can use Math.pow(), unless @mikeharder had any concerns that this might create any performance impact or inconsistencies across languages.
private static int Pow(int value, int exponent) { int power = 1; for (int i=0; i < exponent; i++) { power *= value; } return power; }
}
private static int Pow(int value, int exponent) { int power = 1; for (int i=0; i < exponent; i++) { power *= value; } return power; }
class SleepTest extends PerfStressTest<PerfStressOptions> { private static final AtomicInteger _instanceCount = new AtomicInteger(); private final int _secondsPerOperation; public SleepTest(PerfStressOptions options) { super(options); int instanceCount = _instanceCount.incrementAndGet(); _secondsPerOperation = Pow(2, i...
class SleepTest extends PerfStressTest<PerfStressOptions> { private static final AtomicInteger _instanceCount = new AtomicInteger(); private final int _secondsPerOperation; public SleepTest(PerfStressOptions options) { super(options); int instanceCount = _instanceCount.incrementAndGet(); _secondsPerOperation = Pow(2, i...
I was afraid of the conversion between `double` and `int`. But if you know this is safe you can replace with `Math.pow()`.
private static int Pow(int value, int exponent) { int power = 1; for (int i=0; i < exponent; i++) { power *= value; } return power; }
}
private static int Pow(int value, int exponent) { int power = 1; for (int i=0; i < exponent; i++) { power *= value; } return power; }
class SleepTest extends PerfStressTest<PerfStressOptions> { private static final AtomicInteger _instanceCount = new AtomicInteger(); private final int _secondsPerOperation; public SleepTest(PerfStressOptions options) { super(options); int instanceCount = _instanceCount.incrementAndGet(); _secondsPerOperation = Pow(2, i...
class SleepTest extends PerfStressTest<PerfStressOptions> { private static final AtomicInteger _instanceCount = new AtomicInteger(); private final int _secondsPerOperation; public SleepTest(PerfStressOptions options) { super(options); int instanceCount = _instanceCount.incrementAndGet(); _secondsPerOperation = Pow(2, i...
Math.pow() works for this usecase, we can replace it
private static int Pow(int value, int exponent) { int power = 1; for (int i=0; i < exponent; i++) { power *= value; } return power; }
}
private static int Pow(int value, int exponent) { int power = 1; for (int i=0; i < exponent; i++) { power *= value; } return power; }
class SleepTest extends PerfStressTest<PerfStressOptions> { private static final AtomicInteger _instanceCount = new AtomicInteger(); private final int _secondsPerOperation; public SleepTest(PerfStressOptions options) { super(options); int instanceCount = _instanceCount.incrementAndGet(); _secondsPerOperation = Pow(2, i...
class SleepTest extends PerfStressTest<PerfStressOptions> { private static final AtomicInteger _instanceCount = new AtomicInteger(); private final int _secondsPerOperation; public SleepTest(PerfStressOptions options) { super(options); int instanceCount = _instanceCount.incrementAndGet(); _secondsPerOperation = Pow(2, i...
We should remove all the score equal comparison. Currently. the nightly live test failed because of it. https://dev.azure.com/azure-sdk/internal/_build/results?buildId=242950&view=logs&j=4d5db6ce-0b7f-527e-b115-2367ee6e1fef&t=b7d16dfc-4abf-5ff2-eaa7-e82f3df2ef1b
static DocumentResultCollection<RecognizeEntitiesResult> getExpectedBatchNamedEntities() { NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.80624294281005859); NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.8); NamedEntity namedEntity3 = new Nam...
NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.80624294281005859);
static DocumentResultCollection<RecognizeEntitiesResult> getExpectedBatchNamedEntities() { NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.0); NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.0); NamedEntity namedEntity3 = new NamedEntity("Micros...
class TestUtils { private static final String DEFAULT_MODEL_VERSION = "2019-10-01"; static final List<String> SENTIMENT_INPUTS = Arrays.asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.", "The restaurant had amazing gnocchi. The hotel was dark and unclean."); static final List<String> NAMED_EN...
class TestUtils { private static final String DEFAULT_MODEL_VERSION = "2019-10-01"; static final List<String> SENTIMENT_INPUTS = Arrays.asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.", "The restaurant had amazing gnocchi. The hotel was dark and unclean."); static final List<String> NAMED_EN...
Updated to not check for equality for offset/length/score properties on models.
static DocumentResultCollection<RecognizeEntitiesResult> getExpectedBatchNamedEntities() { NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.80624294281005859); NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.8); NamedEntity namedEntity3 = new Nam...
NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.80624294281005859);
static DocumentResultCollection<RecognizeEntitiesResult> getExpectedBatchNamedEntities() { NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.0); NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.0); NamedEntity namedEntity3 = new NamedEntity("Micros...
class TestUtils { private static final String DEFAULT_MODEL_VERSION = "2019-10-01"; static final List<String> SENTIMENT_INPUTS = Arrays.asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.", "The restaurant had amazing gnocchi. The hotel was dark and unclean."); static final List<String> NAMED_EN...
class TestUtils { private static final String DEFAULT_MODEL_VERSION = "2019-10-01"; static final List<String> SENTIMENT_INPUTS = Arrays.asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.", "The restaurant had amazing gnocchi. The hotel was dark and unclean."); static final List<String> NAMED_EN...
should the score value need to clean up also?
static DocumentResultCollection<RecognizeEntitiesResult> getExpectedBatchNamedEntities() { NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.80624294281005859); NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.8); NamedEntity namedEntity3 = new Nam...
NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.80624294281005859);
static DocumentResultCollection<RecognizeEntitiesResult> getExpectedBatchNamedEntities() { NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.0); NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.0); NamedEntity namedEntity3 = new NamedEntity("Micros...
class TestUtils { private static final String DEFAULT_MODEL_VERSION = "2019-10-01"; static final List<String> SENTIMENT_INPUTS = Arrays.asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.", "The restaurant had amazing gnocchi. The hotel was dark and unclean."); static final List<String> NAMED_EN...
class TestUtils { private static final String DEFAULT_MODEL_VERSION = "2019-10-01"; static final List<String> SENTIMENT_INPUTS = Arrays.asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.", "The restaurant had amazing gnocchi. The hotel was dark and unclean."); static final List<String> NAMED_EN...
same question apply to other hard-coded numerical values
static DocumentResultCollection<RecognizeEntitiesResult> getExpectedBatchNamedEntities() { NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.80624294281005859); NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.8); NamedEntity namedEntity3 = new Nam...
NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.80624294281005859);
static DocumentResultCollection<RecognizeEntitiesResult> getExpectedBatchNamedEntities() { NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.0); NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.0); NamedEntity namedEntity3 = new NamedEntity("Micros...
class TestUtils { private static final String DEFAULT_MODEL_VERSION = "2019-10-01"; static final List<String> SENTIMENT_INPUTS = Arrays.asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.", "The restaurant had amazing gnocchi. The hotel was dark and unclean."); static final List<String> NAMED_EN...
class TestUtils { private static final String DEFAULT_MODEL_VERSION = "2019-10-01"; static final List<String> SENTIMENT_INPUTS = Arrays.asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.", "The restaurant had amazing gnocchi. The hotel was dark and unclean."); static final List<String> NAMED_EN...
Any reason this doesn't default `destinationFileSystem` to the current file system? Looks like `renameWithResponse` will pass the current file system as the `destinationFileSystem` value. Seems odd to allow null in one case and not in another very similar case.
DataLakePathAsyncClient getPathAsyncClient(String destinationFileSystem, String destinationPath) { if (CoreUtils.isNullOrEmpty(destinationFileSystem)) { throw logger.logExceptionAsError(new IllegalArgumentException( "'destinationFileSystem' can not be set to null")); } if (CoreUtils.isNullOrEmpty(destinationPath)) { th...
throw logger.logExceptionAsError(new IllegalArgumentException(
DataLakePathAsyncClient getPathAsyncClient(String destinationFileSystem, String destinationPath) { if (destinationFileSystem == null) { destinationFileSystem = getFileSystemName(); } if (CoreUtils.isNullOrEmpty(destinationPath)) { throw logger.logExceptionAsError(new IllegalArgumentException("'destinationPath' can not ...
class DataLakePathAsyncClient { private final ClientLogger logger = new ClientLogger(DataLakePathAsyncClient.class); protected final DataLakeStorageClientImpl dataLakeStorage; private final String accountName; private final String fileSystemName; private final String pathName; private final DataLakeServiceVersion servi...
class DataLakePathAsyncClient { private final ClientLogger logger = new ClientLogger(DataLakePathAsyncClient.class); protected final DataLakeStorageClientImpl dataLakeStorage; private final String accountName; private final String fileSystemName; private final String pathName; private final DataLakeServiceVersion servi...
Sure, I can change that
DataLakePathAsyncClient getPathAsyncClient(String destinationFileSystem, String destinationPath) { if (CoreUtils.isNullOrEmpty(destinationFileSystem)) { throw logger.logExceptionAsError(new IllegalArgumentException( "'destinationFileSystem' can not be set to null")); } if (CoreUtils.isNullOrEmpty(destinationPath)) { th...
throw logger.logExceptionAsError(new IllegalArgumentException(
DataLakePathAsyncClient getPathAsyncClient(String destinationFileSystem, String destinationPath) { if (destinationFileSystem == null) { destinationFileSystem = getFileSystemName(); } if (CoreUtils.isNullOrEmpty(destinationPath)) { throw logger.logExceptionAsError(new IllegalArgumentException("'destinationPath' can not ...
class DataLakePathAsyncClient { private final ClientLogger logger = new ClientLogger(DataLakePathAsyncClient.class); protected final DataLakeStorageClientImpl dataLakeStorage; private final String accountName; private final String fileSystemName; private final String pathName; private final DataLakeServiceVersion servi...
class DataLakePathAsyncClient { private final ClientLogger logger = new ClientLogger(DataLakePathAsyncClient.class); protected final DataLakeStorageClientImpl dataLakeStorage; private final String accountName; private final String fileSystemName; private final String pathName; private final DataLakeServiceVersion servi...
You might want to consider moving the ternary operation inside the method call and doing it on one line?
public HttpClient build() { OkHttpClient.Builder httpClientBuilder = this.okHttpClient == null ? new OkHttpClient.Builder() : this.okHttpClient.newBuilder(); for (Interceptor interceptor : this.networkInterceptors) { httpClientBuilder = httpClientBuilder.addNetworkInterceptor(interceptor); } httpClientBuilder = (this.r...
: httpClientBuilder.readTimeout(DEFAULT_READ_TIMEOUT);
public HttpClient build() { OkHttpClient.Builder httpClientBuilder = this.okHttpClient == null ? new OkHttpClient.Builder() : this.okHttpClient.newBuilder(); for (Interceptor interceptor : this.networkInterceptors) { httpClientBuilder = httpClientBuilder.addNetworkInterceptor(interceptor); } httpClientBuilder = httpCli...
class OkHttpAsyncHttpClientBuilder { private final ClientLogger logger = new ClientLogger(OkHttpAsyncHttpClientBuilder.class); private final okhttp3.OkHttpClient okHttpClient; private static final Duration DEFAULT_READ_TIMEOUT = Duration.ofSeconds(120); private static final Duration DEFAULT_CONNECT_TIMEOUT = Duration.o...
class OkHttpAsyncHttpClientBuilder { private final ClientLogger logger = new ClientLogger(OkHttpAsyncHttpClientBuilder.class); private final okhttp3.OkHttpClient okHttpClient; private static final Duration DEFAULT_READ_TIMEOUT = Duration.ofSeconds(120); private static final Duration DEFAULT_CONNECT_TIMEOUT = Duration.o...
Done
public HttpClient build() { OkHttpClient.Builder httpClientBuilder = this.okHttpClient == null ? new OkHttpClient.Builder() : this.okHttpClient.newBuilder(); for (Interceptor interceptor : this.networkInterceptors) { httpClientBuilder = httpClientBuilder.addNetworkInterceptor(interceptor); } httpClientBuilder = (this.r...
: httpClientBuilder.readTimeout(DEFAULT_READ_TIMEOUT);
public HttpClient build() { OkHttpClient.Builder httpClientBuilder = this.okHttpClient == null ? new OkHttpClient.Builder() : this.okHttpClient.newBuilder(); for (Interceptor interceptor : this.networkInterceptors) { httpClientBuilder = httpClientBuilder.addNetworkInterceptor(interceptor); } httpClientBuilder = httpCli...
class OkHttpAsyncHttpClientBuilder { private final ClientLogger logger = new ClientLogger(OkHttpAsyncHttpClientBuilder.class); private final okhttp3.OkHttpClient okHttpClient; private static final Duration DEFAULT_READ_TIMEOUT = Duration.ofSeconds(120); private static final Duration DEFAULT_CONNECT_TIMEOUT = Duration.o...
class OkHttpAsyncHttpClientBuilder { private final ClientLogger logger = new ClientLogger(OkHttpAsyncHttpClientBuilder.class); private final okhttp3.OkHttpClient okHttpClient; private static final Duration DEFAULT_READ_TIMEOUT = Duration.ofSeconds(120); private static final Duration DEFAULT_CONNECT_TIMEOUT = Duration.o...
Don't we want Math.ceil() of these values so we round up?
private Response<ShareStatistics> mapGetStatisticsResponse(SharesGetStatisticsResponse response) { ShareStatistics shareStatistics = new ShareStatistics((int) (response.getValue().getShareUsageBytes() / (Constants.GB)), response.getValue().getShareUsageBytes()); return new SimpleResponse<>(response, shareStatistics); }
new ShareStatistics((int) (response.getValue().getShareUsageBytes() / (Constants.GB)),
private Response<ShareStatistics> mapGetStatisticsResponse(SharesGetStatisticsResponse response) { ShareStatistics shareStatistics = new ShareStatistics(response.getValue().getShareUsageBytes()); return new SimpleResponse<>(response, shareStatistics); }
class ShareAsyncClient { private final ClientLogger logger = new ClientLogger(ShareAsyncClient.class); private final AzureFileStorageImpl azureFileStorageClient; private final String shareName; private final String snapshot; private final String accountName; private final ShareServiceVersion serviceVersion; /** * Creat...
class ShareAsyncClient { private final ClientLogger logger = new ClientLogger(ShareAsyncClient.class); private final AzureFileStorageImpl azureFileStorageClient; private final String shareName; private final String snapshot; private final String accountName; private final ShareServiceVersion serviceVersion; /** * Creat...
It might be better to default this to -1 so that customers can tell the difference between not set and empty share
public ShareStatistics(int shareUsageInGB) { this.shareUsageInGB = shareUsageInGB; this.shareUsageInBytes = 0; }
this.shareUsageInBytes = 0;
public ShareStatistics(int shareUsageInGB) { this.shareUsageInGB = shareUsageInGB; this.shareUsageInBytes = -1; }
class ShareStatistics { private final int shareUsageInGB; private final long shareUsageInBytes; /** * Creates an instance of storage statistics for a Share. * * @param shareUsageInGB Size in GB of the Share */ /** * Creates an instance of storage statistics for a Share. * * @param shareUsageInGB Size in GB of the Share...
class ShareStatistics { private final int shareUsageInGB; private final long shareUsageInBytes; /** * Creates an instance of storage statistics for a Share. * * @param shareUsageInGB Size in GB of the Share */ /** * Creates an instance of storage statistics for a Share. * * @param shareUsageInBytes Size in bytes of the...
It might also be better for the new constructor to just take a long and we calculate the share usage in bytes in the constructor.
private Response<ShareStatistics> mapGetStatisticsResponse(SharesGetStatisticsResponse response) { ShareStatistics shareStatistics = new ShareStatistics((int) (response.getValue().getShareUsageBytes() / (Constants.GB)), response.getValue().getShareUsageBytes()); return new SimpleResponse<>(response, shareStatistics); }
new ShareStatistics((int) (response.getValue().getShareUsageBytes() / (Constants.GB)),
private Response<ShareStatistics> mapGetStatisticsResponse(SharesGetStatisticsResponse response) { ShareStatistics shareStatistics = new ShareStatistics(response.getValue().getShareUsageBytes()); return new SimpleResponse<>(response, shareStatistics); }
class ShareAsyncClient { private final ClientLogger logger = new ClientLogger(ShareAsyncClient.class); private final AzureFileStorageImpl azureFileStorageClient; private final String shareName; private final String snapshot; private final String accountName; private final ShareServiceVersion serviceVersion; /** * Creat...
class ShareAsyncClient { private final ClientLogger logger = new ClientLogger(ShareAsyncClient.class); private final AzureFileStorageImpl azureFileStorageClient; private final String shareName; private final String snapshot; private final String accountName; private final ShareServiceVersion serviceVersion; /** * Creat...
Done
private Response<ShareStatistics> mapGetStatisticsResponse(SharesGetStatisticsResponse response) { ShareStatistics shareStatistics = new ShareStatistics((int) (response.getValue().getShareUsageBytes() / (Constants.GB)), response.getValue().getShareUsageBytes()); return new SimpleResponse<>(response, shareStatistics); }
new ShareStatistics((int) (response.getValue().getShareUsageBytes() / (Constants.GB)),
private Response<ShareStatistics> mapGetStatisticsResponse(SharesGetStatisticsResponse response) { ShareStatistics shareStatistics = new ShareStatistics(response.getValue().getShareUsageBytes()); return new SimpleResponse<>(response, shareStatistics); }
class ShareAsyncClient { private final ClientLogger logger = new ClientLogger(ShareAsyncClient.class); private final AzureFileStorageImpl azureFileStorageClient; private final String shareName; private final String snapshot; private final String accountName; private final ShareServiceVersion serviceVersion; /** * Creat...
class ShareAsyncClient { private final ClientLogger logger = new ClientLogger(ShareAsyncClient.class); private final AzureFileStorageImpl azureFileStorageClient; private final String shareName; private final String snapshot; private final String accountName; private final ShareServiceVersion serviceVersion; /** * Creat...
Done
public ShareStatistics(int shareUsageInGB) { this.shareUsageInGB = shareUsageInGB; this.shareUsageInBytes = 0; }
this.shareUsageInBytes = 0;
public ShareStatistics(int shareUsageInGB) { this.shareUsageInGB = shareUsageInGB; this.shareUsageInBytes = -1; }
class ShareStatistics { private final int shareUsageInGB; private final long shareUsageInBytes; /** * Creates an instance of storage statistics for a Share. * * @param shareUsageInGB Size in GB of the Share */ /** * Creates an instance of storage statistics for a Share. * * @param shareUsageInGB Size in GB of the Share...
class ShareStatistics { private final int shareUsageInGB; private final long shareUsageInBytes; /** * Creates an instance of storage statistics for a Share. * * @param shareUsageInGB Size in GB of the Share */ /** * Creates an instance of storage statistics for a Share. * * @param shareUsageInBytes Size in bytes of the...
Would be good to add a unit test case for this change.
public void subscribe(CoreSubscriber<? super AsyncPollResponse<T, U>> actual) { this.oneTimeActivationMono .flatMapMany(ignored -> { final PollResponse<T> activationResponse = this.rootContext.getActivationResponse(); if (activationResponse.getStatus().isComplete()) { return Flux.just(new AsyncPollResponse<>(this.rootC...
.flatMapMany(ignored -> {
public void subscribe(CoreSubscriber<? super AsyncPollResponse<T, U>> actual) { this.oneTimeActivationMono .flatMapMany(ignored -> { final PollResponse<T> activationResponse = this.rootContext.getActivationResponse(); if (activationResponse.getStatus().isComplete()) { return Flux.just(new AsyncPollResponse<>(this.rootC...
class PollerFlux<T, U> extends Flux<AsyncPollResponse<T, U>> { private final ClientLogger logger = new ClientLogger(PollerFlux.class); private final PollingContext<T> rootContext = new PollingContext<>(); private final Duration defaultPollInterval; private final Function<PollingContext<T>, Mono<T>> activationOperation;...
class PollerFlux<T, U> extends Flux<AsyncPollResponse<T, U>> { private final ClientLogger logger = new ClientLogger(PollerFlux.class); private final PollingContext<T> rootContext = new PollingContext<>(); private final Duration defaultPollInterval; private final Function<PollingContext<T>, Mono<PollResponse<T>>> pollOp...
tests added
public void subscribe(CoreSubscriber<? super AsyncPollResponse<T, U>> actual) { this.oneTimeActivationMono .flatMapMany(ignored -> { final PollResponse<T> activationResponse = this.rootContext.getActivationResponse(); if (activationResponse.getStatus().isComplete()) { return Flux.just(new AsyncPollResponse<>(this.rootC...
.flatMapMany(ignored -> {
public void subscribe(CoreSubscriber<? super AsyncPollResponse<T, U>> actual) { this.oneTimeActivationMono .flatMapMany(ignored -> { final PollResponse<T> activationResponse = this.rootContext.getActivationResponse(); if (activationResponse.getStatus().isComplete()) { return Flux.just(new AsyncPollResponse<>(this.rootC...
class PollerFlux<T, U> extends Flux<AsyncPollResponse<T, U>> { private final ClientLogger logger = new ClientLogger(PollerFlux.class); private final PollingContext<T> rootContext = new PollingContext<>(); private final Duration defaultPollInterval; private final Function<PollingContext<T>, Mono<T>> activationOperation;...
class PollerFlux<T, U> extends Flux<AsyncPollResponse<T, U>> { private final ClientLogger logger = new ClientLogger(PollerFlux.class); private final PollingContext<T> rootContext = new PollingContext<>(); private final Duration defaultPollInterval; private final Function<PollingContext<T>, Mono<PollResponse<T>>> pollOp...
Passing in an empty string gives an invalid country hint error?
public void detectLanguageInvalidCountryHint() { Exception exception = assertThrows(TextAnalyticsException.class, () -> client.detectLanguage("")); assertTrue(exception.getMessage().equals(INVALID_COUNTRY_HINT_EXPECTED_EXCEPTION_MESSAGE)); }
assertTrue(exception.getMessage().equals(INVALID_COUNTRY_HINT_EXPECTED_EXCEPTION_MESSAGE));
public void detectLanguageInvalidCountryHint() { Exception exception = assertThrows(TextAnalyticsException.class, () -> client.detectLanguageWithResponse("Este es un document escrito en Español.", "en", Context.NONE)); assertTrue(exception.getMessage().equals(INVALID_COUNTRY_HINT_EXPECTED_EXCEPTION_MESSAGE)); }
class TextAnalyticsClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsClient client; @Override protected void beforeTest() { client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() .endpoint(getEndpoint()) .pipeline(httpPipeline) .buildClient()); } /** * Verify that we can get statistic...
class TextAnalyticsClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsClient client; @Override protected void beforeTest() { client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() .endpoint(getEndpoint()) .pipeline(httpPipeline) .buildClient()); } /** * Verify that we can get statistic...
Is it possible to have a target without an error code a vice-versa? This seems like it could be cleaned up to check that both aren't 'null' at once and do a full string formatting.
public String getMessage() { String baseMessage = super.getMessage(); if (this.errorCodeValue == null) { return super.getMessage(); } else { baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "ErrorCodeValue", errorCodeValue); } if (this.target == null) { return baseMessage; } else { baseMessage = Str...
}
public String getMessage() { StringBuilder baseMessage = new StringBuilder().append(super.getMessage()).append(" ").append(ERROR_CODE) .append(": {").append(errorCodeValue).append("}"); if (this.target == null) { return baseMessage.toString(); } else { return baseMessage.append(", ").append(TARGET).append(": {").append...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private final String errorCodeValue; private final String target; /** * Initializes a new instance of the TextAnalyticsException class. * @param message Text containing any additional details of the ex...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private static final String ERROR_CODE = "ErrorCodeValue"; private static final String TARGET = "target"; private final String errorCodeValue; private final String target; /** * Initializes a new insta...
`baseMessage` could be returned here instead of retrieving it from the super class again.
public String getMessage() { String baseMessage = super.getMessage(); if (this.errorCodeValue == null) { return super.getMessage(); } else { baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "ErrorCodeValue", errorCodeValue); } if (this.target == null) { return baseMessage; } else { baseMessage = Str...
return super.getMessage();
public String getMessage() { StringBuilder baseMessage = new StringBuilder().append(super.getMessage()).append(" ").append(ERROR_CODE) .append(": {").append(errorCodeValue).append("}"); if (this.target == null) { return baseMessage.toString(); } else { return baseMessage.append(", ").append(TARGET).append(": {").append...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private final String errorCodeValue; private final String target; /** * Initializes a new instance of the TextAnalyticsException class. * @param message Text containing any additional details of the ex...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private static final String ERROR_CODE = "ErrorCodeValue"; private static final String TARGET = "target"; private final String errorCodeValue; private final String target; /** * Initializes a new insta...
Let's make 'ErrorCodeValue` a constant
public String getMessage() { String baseMessage = super.getMessage(); if (this.errorCodeValue == null) { return super.getMessage(); } else { baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "ErrorCodeValue", errorCodeValue); } if (this.target == null) { return baseMessage; } else { baseMessage = Str...
baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "ErrorCodeValue",
public String getMessage() { StringBuilder baseMessage = new StringBuilder().append(super.getMessage()).append(" ").append(ERROR_CODE) .append(": {").append(errorCodeValue).append("}"); if (this.target == null) { return baseMessage.toString(); } else { return baseMessage.append(", ").append(TARGET).append(": {").append...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private final String errorCodeValue; private final String target; /** * Initializes a new instance of the TextAnalyticsException class. * @param message Text containing any additional details of the ex...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private static final String ERROR_CODE = "ErrorCodeValue"; private static final String TARGET = "target"; private final String errorCodeValue; private final String target; /** * Initializes a new insta...
Let's make `target` a constant
public String getMessage() { String baseMessage = super.getMessage(); if (this.errorCodeValue == null) { return super.getMessage(); } else { baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "ErrorCodeValue", errorCodeValue); } if (this.target == null) { return baseMessage; } else { baseMessage = Str...
baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "target", target);
public String getMessage() { StringBuilder baseMessage = new StringBuilder().append(super.getMessage()).append(" ").append(ERROR_CODE) .append(": {").append(errorCodeValue).append("}"); if (this.target == null) { return baseMessage.toString(); } else { return baseMessage.append(", ").append(TARGET).append(": {").append...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private final String errorCodeValue; private final String target; /** * Initializes a new instance of the TextAnalyticsException class. * @param message Text containing any additional details of the ex...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private static final String ERROR_CODE = "ErrorCodeValue"; private static final String TARGET = "target"; private final String errorCodeValue; private final String target; /** * Initializes a new insta...
Actually, why isn't this in the format string?
public String getMessage() { String baseMessage = super.getMessage(); if (this.errorCodeValue == null) { return super.getMessage(); } else { baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "ErrorCodeValue", errorCodeValue); } if (this.target == null) { return baseMessage; } else { baseMessage = Str...
baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "ErrorCodeValue",
public String getMessage() { StringBuilder baseMessage = new StringBuilder().append(super.getMessage()).append(" ").append(ERROR_CODE) .append(": {").append(errorCodeValue).append("}"); if (this.target == null) { return baseMessage.toString(); } else { return baseMessage.append(", ").append(TARGET).append(": {").append...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private final String errorCodeValue; private final String target; /** * Initializes a new instance of the TextAnalyticsException class. * @param message Text containing any additional details of the ex...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private static final String ERROR_CODE = "ErrorCodeValue"; private static final String TARGET = "target"; private final String errorCodeValue; private final String target; /** * Initializes a new insta...
Actually, why isn't this in the format string?
public String getMessage() { String baseMessage = super.getMessage(); if (this.errorCodeValue == null) { return super.getMessage(); } else { baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "ErrorCodeValue", errorCodeValue); } if (this.target == null) { return baseMessage; } else { baseMessage = Str...
baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "target", target);
public String getMessage() { StringBuilder baseMessage = new StringBuilder().append(super.getMessage()).append(" ").append(ERROR_CODE) .append(": {").append(errorCodeValue).append("}"); if (this.target == null) { return baseMessage.toString(); } else { return baseMessage.append(", ").append(TARGET).append(": {").append...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private final String errorCodeValue; private final String target; /** * Initializes a new instance of the TextAnalyticsException class. * @param message Text containing any additional details of the ex...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private static final String ERROR_CODE = "ErrorCodeValue"; private static final String TARGET = "target"; private final String errorCodeValue; private final String target; /** * Initializes a new insta...
Could a `StringBuilder` be used instead of using two `String.format` calls?
public String getMessage() { String baseMessage = super.getMessage(); if (this.errorCodeValue == null) { return super.getMessage(); } else { baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "ErrorCodeValue", errorCodeValue); } if (this.target == null) { return baseMessage; } else { baseMessage = Str...
baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "target", target);
public String getMessage() { StringBuilder baseMessage = new StringBuilder().append(super.getMessage()).append(" ").append(ERROR_CODE) .append(": {").append(errorCodeValue).append("}"); if (this.target == null) { return baseMessage.toString(); } else { return baseMessage.append(", ").append(TARGET).append(": {").append...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private final String errorCodeValue; private final String target; /** * Initializes a new instance of the TextAnalyticsException class. * @param message Text containing any additional details of the ex...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private static final String ERROR_CODE = "ErrorCodeValue"; private static final String TARGET = "target"; private final String errorCodeValue; private final String target; /** * Initializes a new insta...
Why do the other `String.format` changes use `Locale.ROOT` where this does not?
void throwExceptionIfError() { if (this.isError()) { throw logger.logExceptionAsError(new TextAnalyticsException( String.format("Error in accessing the property on document id: %s, when %s returned with an error: %s", this.id, this.getClass().getSimpleName(), this.error.getMessage()), this.error.getCode().toString(), n...
this.id, this.getClass().getSimpleName(), this.error.getMessage()),
void throwExceptionIfError() { if (this.isError()) { throw logger.logExceptionAsError(new TextAnalyticsException( String.format(Locale.ROOT, "Error in accessing the property on document id: %s, when %s returned with an error: %s", this.id, this.getClass().getSimpleName(), this.error.getMessage()), this.error.getCode()....
class DocumentResult { private final String id; private final TextDocumentStatistics textDocumentStatistics; private final TextAnalyticsError error; private final boolean isError; private final ClientLogger logger = new ClientLogger(DocumentResult.class); /** * Create a {@code DocumentResult} model that maintains docum...
class DocumentResult { private final ClientLogger logger = new ClientLogger(DocumentResult.class); private final String id; private final TextDocumentStatistics textDocumentStatistics; private final TextAnalyticsError error; private final boolean isError; /** * Create a {@code DocumentResult} model that maintains docum...
It should always have error code but target can be null. Can clean it that way.
public String getMessage() { String baseMessage = super.getMessage(); if (this.errorCodeValue == null) { return super.getMessage(); } else { baseMessage = String.format(Locale.ROOT, "%s %s: {%s}", baseMessage, "ErrorCodeValue", errorCodeValue); } if (this.target == null) { return baseMessage; } else { baseMessage = Str...
}
public String getMessage() { StringBuilder baseMessage = new StringBuilder().append(super.getMessage()).append(" ").append(ERROR_CODE) .append(": {").append(errorCodeValue).append("}"); if (this.target == null) { return baseMessage.toString(); } else { return baseMessage.append(", ").append(TARGET).append(": {").append...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private final String errorCodeValue; private final String target; /** * Initializes a new instance of the TextAnalyticsException class. * @param message Text containing any additional details of the ex...
class TextAnalyticsException extends AzureException { private static final long serialVersionUID = 21436310107606058L; private static final String ERROR_CODE = "ErrorCodeValue"; private static final String TARGET = "target"; private final String errorCodeValue; private final String target; /** * Initializes a new insta...
nit: can use method reference instead ```suggestion .map(Transforms::processSingleResponseErrorResult); ```
Mono<Response<AnalyzeSentimentResult>> analyzeSentimentWithResponse(String text, String language, Context context) { Objects.requireNonNull(text, "'text' cannot be null."); return analyzeBatchSentimentWithResponse( Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) .map(response -> pr...
.map(response -> processSingleResponseErrorResult(response));
return analyzeBatchSentimentWithResponse( Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) .map(Transforms::processSingleResponseErrorResult); } Mono<Response<DocumentResultCollection<AnalyzeSentimentResult>>> analyzeSentimentWithResponse( List<String> textInputs, String language, C...
class AnalyzeSentimentAsyncClient { private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create a {@code AnalyzeSentimentAsyncClient} that sends requests to the Text Analytics services's sentiment * analysis endpoint. * * @param se...
class AnalyzeSentimentAsyncClient { private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create a {@code AnalyzeSentimentAsyncClient} that sends requests to the Text Analytics services's sentiment * analysis endpoint. * * @param se...
Shouldn't you be asserting the `UNWRAP_KEY` permission?
Mono<UnwrapResult> unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context) { Objects.requireNonNull(algorithm, "Key Wrap algorithm cannot be null."); Objects.requireNonNull(encryptedKey, "Encrypted key content to be unwrapped cannot be null."); return ensureValidKeyAvailable().flatMap(available -> {...
if (!checkKeyPermissions(this.key.get().getKeyOps(), KeyOperation.WRAP_KEY)) {
Mono<UnwrapResult> unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context) { Objects.requireNonNull(algorithm, "Key Wrap algorithm cannot be null."); Objects.requireNonNull(encryptedKey, "Encrypted key content to be unwrapped cannot be null."); return ensureValidKeyAvailable().flatMap(available -> {...
class CryptographyAsyncClient { static final String KEY_VAULT_SCOPE = "https: static final String SECRETS_COLLECTION = "secrets"; AtomicReference<JsonWebKey> key; private final CryptographyService service; private CryptographyServiceClient cryptographyServiceClient; private LocalKeyCryptographyClient localKeyCryptograp...
class CryptographyAsyncClient { static final String KEY_VAULT_SCOPE = "https: static final String SECRETS_COLLECTION = "secrets"; JsonWebKey key; private final CryptographyService service; private CryptographyServiceClient cryptographyServiceClient; private LocalKeyCryptographyClient localKeyCryptographyClient; private...
Nit: here and the line below spends time negating, which slows things down a little but also makes readability more difficult. Could maybe be simplified.
private Mono<Boolean> ensureValidKeyAvailable() { boolean keyAvailable = !(this.key == null && keyCollection != null); if (!keyAvailable) { if (keyCollection.equals(SECRETS_COLLECTION)) { return getSecretKey().flatMap(jwk -> { this.key = new AtomicReference<>(jwk); initializeCryptoClients(); return Mono.just(this.key.g...
boolean keyAvailable = !(this.key == null && keyCollection != null);
private Mono<Boolean> ensureValidKeyAvailable() { boolean keyNotAvailable = (this.key == null && keyCollection != null); if (keyNotAvailable) { if (keyCollection.equals(SECRETS_COLLECTION)) { return getSecretKey().map(jwk -> { this.key = (jwk); initializeCryptoClients(); return this.key.isValid(); }); } else { return g...
class CryptographyAsyncClient { static final String KEY_VAULT_SCOPE = "https: static final String SECRETS_COLLECTION = "secrets"; AtomicReference<JsonWebKey> key; private final CryptographyService service; private CryptographyServiceClient cryptographyServiceClient; private LocalKeyCryptographyClient localKeyCryptograp...
class CryptographyAsyncClient { static final String KEY_VAULT_SCOPE = "https: static final String SECRETS_COLLECTION = "secrets"; JsonWebKey key; private final CryptographyService service; private CryptographyServiceClient cryptographyServiceClient; private LocalKeyCryptographyClient localKeyCryptographyClient; private...