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
Shoundn't this already happen inside BlobInputStream ? If not would it be possible to push it down there instead of creating new type ?
public int read() throws IOException { try { return this.blobInputStream.read(); } catch (RuntimeException e) { if (e.getMessage().equals(Constants.STREAM_CLOSED)) { throw LoggingUtility.logError(logger, new IOException(e)); } throw LoggingUtility.logError(logger, e); } }
throw LoggingUtility.logError(logger, e);
public int read() throws IOException { try { return this.blobInputStream.read(); /* BlobInputStream only throws RuntimeException, and it doesn't preserve the cause, it only takes the message, so we can't do any better than re-wrapping it in an IOException. */ } catch (RuntimeException e) { throw LoggingUtility.logError...
class NioBlobInputStream extends InputStream { private final ClientLogger logger = new ClientLogger(NioBlobInputStream.class); private final BlobInputStream blobInputStream; NioBlobInputStream(BlobInputStream blobInputStream) { this.blobInputStream = blobInputStream; } /** * Returns an estimate of the number of bytes t...
class NioBlobInputStream extends InputStream { private final ClientLogger logger = new ClientLogger(NioBlobInputStream.class); private final BlobInputStream blobInputStream; NioBlobInputStream(BlobInputStream blobInputStream) { this.blobInputStream = blobInputStream; } /** * Returns an estimate of the number of bytes t...
BlobInputStream throws RuntimeExceptions, and the contract specifies that these methods are supposed to throw an IOException. I suspect that BlobInputStream was changed to throw RuntimeExceptions to work better with Reactor, but in an environment that isn't touched by async stuff, I think it's best to conform to the ac...
public int read() throws IOException { try { return this.blobInputStream.read(); } catch (RuntimeException e) { if (e.getMessage().equals(Constants.STREAM_CLOSED)) { throw LoggingUtility.logError(logger, new IOException(e)); } throw LoggingUtility.logError(logger, e); } }
throw LoggingUtility.logError(logger, e);
public int read() throws IOException { try { return this.blobInputStream.read(); /* BlobInputStream only throws RuntimeException, and it doesn't preserve the cause, it only takes the message, so we can't do any better than re-wrapping it in an IOException. */ } catch (RuntimeException e) { throw LoggingUtility.logError...
class NioBlobInputStream extends InputStream { private final ClientLogger logger = new ClientLogger(NioBlobInputStream.class); private final BlobInputStream blobInputStream; NioBlobInputStream(BlobInputStream blobInputStream) { this.blobInputStream = blobInputStream; } /** * Returns an estimate of the number of bytes t...
class NioBlobInputStream extends InputStream { private final ClientLogger logger = new ClientLogger(NioBlobInputStream.class); private final BlobInputStream blobInputStream; NioBlobInputStream(BlobInputStream blobInputStream) { this.blobInputStream = blobInputStream; } /** * Returns an estimate of the number of bytes t...
I'm not sure if BlobInputStream throwin RuntimeException is/was intentional. As you said the InputStream contract forces caller to handle IOException, so reactive code we have that's calling it should be handling/convering IOExceptions (otherwise compiler wouldn't be happy) - if that's the case I think we could safely ...
public int read() throws IOException { try { return this.blobInputStream.read(); } catch (RuntimeException e) { if (e.getMessage().equals(Constants.STREAM_CLOSED)) { throw LoggingUtility.logError(logger, new IOException(e)); } throw LoggingUtility.logError(logger, e); } }
throw LoggingUtility.logError(logger, e);
public int read() throws IOException { try { return this.blobInputStream.read(); /* BlobInputStream only throws RuntimeException, and it doesn't preserve the cause, it only takes the message, so we can't do any better than re-wrapping it in an IOException. */ } catch (RuntimeException e) { throw LoggingUtility.logError...
class NioBlobInputStream extends InputStream { private final ClientLogger logger = new ClientLogger(NioBlobInputStream.class); private final BlobInputStream blobInputStream; NioBlobInputStream(BlobInputStream blobInputStream) { this.blobInputStream = blobInputStream; } /** * Returns an estimate of the number of bytes t...
class NioBlobInputStream extends InputStream { private final ClientLogger logger = new ClientLogger(NioBlobInputStream.class); private final BlobInputStream blobInputStream; NioBlobInputStream(BlobInputStream blobInputStream) { this.blobInputStream = blobInputStream; } /** * Returns an estimate of the number of bytes t...
I think changing the kinds of exceptions we throw is a breaking change, even if the customer theoretically should be handling it already, no?
public int read() throws IOException { try { return this.blobInputStream.read(); } catch (RuntimeException e) { if (e.getMessage().equals(Constants.STREAM_CLOSED)) { throw LoggingUtility.logError(logger, new IOException(e)); } throw LoggingUtility.logError(logger, e); } }
throw LoggingUtility.logError(logger, e);
public int read() throws IOException { try { return this.blobInputStream.read(); /* BlobInputStream only throws RuntimeException, and it doesn't preserve the cause, it only takes the message, so we can't do any better than re-wrapping it in an IOException. */ } catch (RuntimeException e) { throw LoggingUtility.logError...
class NioBlobInputStream extends InputStream { private final ClientLogger logger = new ClientLogger(NioBlobInputStream.class); private final BlobInputStream blobInputStream; NioBlobInputStream(BlobInputStream blobInputStream) { this.blobInputStream = blobInputStream; } /** * Returns an estimate of the number of bytes t...
class NioBlobInputStream extends InputStream { private final ClientLogger logger = new ClientLogger(NioBlobInputStream.class); private final BlobInputStream blobInputStream; NioBlobInputStream(BlobInputStream blobInputStream) { this.blobInputStream = blobInputStream; } /** * Returns an estimate of the number of bytes t...
Since we're talking about `RuntimeException` vs `IOException` I think it all boils down to how did we document `@throws` in existing streams. For example [here](https://github.com/Azure/azure-sdk-for-java/blob/895bf6f96ca5926e6071f5055e95101e2cb133dc/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/com...
public int read() throws IOException { try { return this.blobInputStream.read(); } catch (RuntimeException e) { if (e.getMessage().equals(Constants.STREAM_CLOSED)) { throw LoggingUtility.logError(logger, new IOException(e)); } throw LoggingUtility.logError(logger, e); } }
throw LoggingUtility.logError(logger, e);
public int read() throws IOException { try { return this.blobInputStream.read(); /* BlobInputStream only throws RuntimeException, and it doesn't preserve the cause, it only takes the message, so we can't do any better than re-wrapping it in an IOException. */ } catch (RuntimeException e) { throw LoggingUtility.logError...
class NioBlobInputStream extends InputStream { private final ClientLogger logger = new ClientLogger(NioBlobInputStream.class); private final BlobInputStream blobInputStream; NioBlobInputStream(BlobInputStream blobInputStream) { this.blobInputStream = blobInputStream; } /** * Returns an estimate of the number of bytes t...
class NioBlobInputStream extends InputStream { private final ClientLogger logger = new ClientLogger(NioBlobInputStream.class); private final BlobInputStream blobInputStream; NioBlobInputStream(BlobInputStream blobInputStream) { this.blobInputStream = blobInputStream; } /** * Returns an estimate of the number of bytes t...
These two methods can simplify to be one generic method. ``` private String getSasUri(String sasUrl) {} ```
private String getTestingSasUri() { return interceptorManager.isPlaybackMode() ? "https: : Configuration.getGlobalConfiguration().get(FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL); }
: Configuration.getGlobalConfiguration().get(FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL);
private String getTestingSasUri() { return interceptorManager.isPlaybackMode() ? "https: : Configuration.getGlobalConfiguration().get(FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL); }
class FormTrainingClientTestBase extends TestBase { static final String FORM_RECOGNIZER_TRAINING_BLOB_CONTAINER_SAS_URL = "FORM_RECOGNIZER_TRAINING_BLOB_CONTAINER_SAS_URL"; static final String FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL = "FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL"; static final String AZURE_FO...
class FormTrainingClientTestBase extends TestBase { static final String FORM_RECOGNIZER_TRAINING_BLOB_CONTAINER_SAS_URL = "FORM_RECOGNIZER_TRAINING_BLOB_CONTAINER_SAS_URL"; static final String FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL = "FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL"; static final String AZURE_FO...
they are returning different configurations
private String getTestingSasUri() { return interceptorManager.isPlaybackMode() ? "https: : Configuration.getGlobalConfiguration().get(FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL); }
: Configuration.getGlobalConfiguration().get(FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL);
private String getTestingSasUri() { return interceptorManager.isPlaybackMode() ? "https: : Configuration.getGlobalConfiguration().get(FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL); }
class FormTrainingClientTestBase extends TestBase { static final String FORM_RECOGNIZER_TRAINING_BLOB_CONTAINER_SAS_URL = "FORM_RECOGNIZER_TRAINING_BLOB_CONTAINER_SAS_URL"; static final String FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL = "FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL"; static final String AZURE_FO...
class FormTrainingClientTestBase extends TestBase { static final String FORM_RECOGNIZER_TRAINING_BLOB_CONTAINER_SAS_URL = "FORM_RECOGNIZER_TRAINING_BLOB_CONTAINER_SAS_URL"; static final String FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL = "FORM_RECOGNIZER_TESTING_BLOB_CONTAINER_SAS_URL"; static final String AZURE_FO...
I would use parametrized SqlQuerySpec instead of concating strings
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers("select * from c where c.offerResourceId = '" + response.getProperties() .getResourceId() + "'", new FeedOptions()) .single() .flatMap(o...
.getResourceId()
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
class type * @return a {@link CosmosPagedFlux}
class type * @return a {@link CosmosPagedFlux}
Changed to use querySpec
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers("select * from c where c.offerResourceId = '" + response.getProperties() .getResourceId() + "'", new FeedOptions()) .single() .flatMap(o...
.getResourceId()
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
class type * @return a {@link CosmosPagedFlux}
class type * @return a {@link CosmosPagedFlux}
it might worth to include the name of database and container in the sdk generated error message.
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
"resource"));
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
class type * @return a {@link CosmosPagedFlux}
class type * @return a {@link CosmosPagedFlux}
it is worth including the name of the database and container in the sdk generated error message.
public Mono<ThroughputResponse> readThroughput() { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedResponse -> { if (offerFeedResponse.getResults...
"No offers found for the resource"));
public Mono<ThroughputResponse> readThroughput() { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedResponse -> { if (offerFeedResponse.getResults...
class type * @return a {@link CosmosPagedFlux}
class type * @return a {@link CosmosPagedFlux}
it is worth including the name of the database in the sdk generated error message.
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.getDocClientWrapper() .queryOffers(getOfferQuerySpecFromResourceId(response.getProperties() .getResourceId()), new FeedOptions()) .single() .flatMap(offerFeedResponse -> { if (offe...
"resource"));
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.getDocClientWrapper() .queryOffers(getOfferQuerySpecFromResourceId(response.getProperties() .getResourceId()), new FeedOptions()) .single() .flatMap(offerFeedResponse -> { if (offe...
class CosmosAsyncDatabase { private final CosmosAsyncClient client; private final String id; private final String link; CosmosAsyncDatabase(String id, CosmosAsyncClient client) { this.id = id; this.client = client; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); } /** * Get the id of the Cosmos...
class CosmosAsyncDatabase { private final CosmosAsyncClient client; private final String id; private final String link; CosmosAsyncDatabase(String id, CosmosAsyncClient client) { this.id = id; this.client = client; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); } /** * Get the id of the Cosmos...
ditto
public Mono<ThroughputResponse> readThroughput() { return this.read() .flatMap(response -> getDocClientWrapper() .queryOffers(getOfferQuerySpecFromResourceId(response.getProperties() .getResourceId()), new FeedOptions()) .single() .flatMap(offerFeedResponse -> { if (offerFeedResponse.getResults().isEmpty()) { return Mo...
"resource"));
public Mono<ThroughputResponse> readThroughput() { return this.read() .flatMap(response -> getDocClientWrapper() .queryOffers(getOfferQuerySpecFromResourceId(response.getProperties() .getResourceId()), new FeedOptions()) .single() .flatMap(offerFeedResponse -> { if (offerFeedResponse.getResults().isEmpty()) { return Mo...
class CosmosAsyncDatabase { private final CosmosAsyncClient client; private final String id; private final String link; CosmosAsyncDatabase(String id, CosmosAsyncClient client) { this.id = id; this.client = client; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); } /** * Get the id of the Cosmos...
class CosmosAsyncDatabase { private final CosmosAsyncClient client; private final String id; private final String link; CosmosAsyncDatabase(String id, CosmosAsyncClient client) { this.id = id; this.client = client; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); } /** * Get the id of the Cosmos...
@j82w lets please track it part of diagnostics improvement.
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.getDocClientWrapper() .queryOffers(getOfferQuerySpecFromResourceId(response.getProperties() .getResourceId()), new FeedOptions()) .single() .flatMap(offerFeedResponse -> { if (offe...
"resource"));
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.getDocClientWrapper() .queryOffers(getOfferQuerySpecFromResourceId(response.getProperties() .getResourceId()), new FeedOptions()) .single() .flatMap(offerFeedResponse -> { if (offe...
class CosmosAsyncDatabase { private final CosmosAsyncClient client; private final String id; private final String link; CosmosAsyncDatabase(String id, CosmosAsyncClient client) { this.id = id; this.client = client; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); } /** * Get the id of the Cosmos...
class CosmosAsyncDatabase { private final CosmosAsyncClient client; private final String id; private final String link; CosmosAsyncDatabase(String id, CosmosAsyncClient client) { this.id = id; this.client = client; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); } /** * Get the id of the Cosmos...
Is the indentation right? It looks very nested and deep. @moderakh ?
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
.flatMap(response -> this.database.getDocClientWrapper()
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
class type * @return a {@link CosmosPagedFlux}
class type * @return a {@link CosmosPagedFlux}
In practice its only possible if name is invalid right? How about reflecting the same in the exception message.
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
"No offers found for the " +
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
class type * @return a {@link CosmosPagedFlux}
class type * @return a {@link CosmosPagedFlux}
Added resource name
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
"resource"));
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
class type * @return a {@link CosmosPagedFlux}
class type * @return a {@link CosmosPagedFlux}
Added resource name
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.getDocClientWrapper() .queryOffers(getOfferQuerySpecFromResourceId(response.getProperties() .getResourceId()), new FeedOptions()) .single() .flatMap(offerFeedResponse -> { if (offe...
"resource"));
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.getDocClientWrapper() .queryOffers(getOfferQuerySpecFromResourceId(response.getProperties() .getResourceId()), new FeedOptions()) .single() .flatMap(offerFeedResponse -> { if (offe...
class CosmosAsyncDatabase { private final CosmosAsyncClient client; private final String id; private final String link; CosmosAsyncDatabase(String id, CosmosAsyncClient client) { this.id = id; this.client = client; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); } /** * Get the id of the Cosmos...
class CosmosAsyncDatabase { private final CosmosAsyncClient client; private final String id; private final String link; CosmosAsyncDatabase(String id, CosmosAsyncClient client) { this.id = id; this.client = client; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); } /** * Get the id of the Cosmos...
Added resource name
public Mono<ThroughputResponse> readThroughput() { return this.read() .flatMap(response -> getDocClientWrapper() .queryOffers(getOfferQuerySpecFromResourceId(response.getProperties() .getResourceId()), new FeedOptions()) .single() .flatMap(offerFeedResponse -> { if (offerFeedResponse.getResults().isEmpty()) { return Mo...
"resource"));
public Mono<ThroughputResponse> readThroughput() { return this.read() .flatMap(response -> getDocClientWrapper() .queryOffers(getOfferQuerySpecFromResourceId(response.getProperties() .getResourceId()), new FeedOptions()) .single() .flatMap(offerFeedResponse -> { if (offerFeedResponse.getResults().isEmpty()) { return Mo...
class CosmosAsyncDatabase { private final CosmosAsyncClient client; private final String id; private final String link; CosmosAsyncDatabase(String id, CosmosAsyncClient client) { this.id = id; this.client = client; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); } /** * Get the id of the Cosmos...
class CosmosAsyncDatabase { private final CosmosAsyncClient client; private final String id; private final String link; CosmosAsyncDatabase(String id, CosmosAsyncClient client) { this.id = id; this.client = client; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); } /** * Get the id of the Cosmos...
Added resource id in the error message which should help.
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
"No offers found for the " +
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
class type * @return a {@link CosmosPagedFlux}
class type * @return a {@link CosmosPagedFlux}
It looks a bit weird, but this is correct. Also this is the best intellij could do :)
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
.flatMap(response -> this.database.getDocClientWrapper()
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
class type * @return a {@link CosmosPagedFlux}
class type * @return a {@link CosmosPagedFlux}
The indentation is correct. The nesting is the result of reactive-stream chaining and lambdas
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
.flatMap(response -> this.database.getDocClientWrapper()
public Mono<ThroughputResponse> replaceThroughput(ThroughputProperties throughputProperties) { return this.read() .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response .getProperties() .getResourceId()) , new FeedOptions()) .single() .flatMap(offerFeedRe...
class type * @return a {@link CosmosPagedFlux}
class type * @return a {@link CosmosPagedFlux}
It might be better to add "avro/binary" as a constant in [ContentType.java](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core/src/main/java/com/azure/core/http/ContentType.java)
private Mono<HttpResponse> playbackHttpResponse(final HttpRequest request) { final String incomingUrl = applyReplacementRule(request.getUrl().toString()); final String incomingMethod = request.getHttpMethod().toString(); final String matchingUrl = removeHost(incomingUrl); NetworkCallRecord networkCallRecord = recordedD...
|| contentType.equalsIgnoreCase("avro/binary"))) {
private Mono<HttpResponse> playbackHttpResponse(final HttpRequest request) { final String incomingUrl = applyReplacementRule(request.getUrl().toString()); final String incomingMethod = request.getHttpMethod().toString(); final String matchingUrl = removeHost(incomingUrl); NetworkCallRecord networkCallRecord = recordedD...
class PlaybackClient implements HttpClient { private static final String X_MS_CLIENT_REQUEST_ID = "x-ms-client-request-id"; private static final String X_MS_ENCRYPTION_KEY_SHA256 = "x-ms-encryption-key-sha256"; private final ClientLogger logger = new ClientLogger(PlaybackClient.class); private final AtomicInteger count...
class PlaybackClient implements HttpClient { private static final String X_MS_CLIENT_REQUEST_ID = "x-ms-client-request-id"; private static final String X_MS_ENCRYPTION_KEY_SHA256 = "x-ms-encryption-key-sha256"; private final ClientLogger logger = new ClientLogger(PlaybackClient.class); private final AtomicInteger count...
Will it throw if you call dispose twice?
public void close() { asyncClient.close(); if (messageProcessor.get() != null) { messageProcessor.get().dispose(); } Disposable activeSubscription = messageProcessorSubscription.get(); if (activeSubscription != null) { activeSubscription.dispose(); } }
if (messageProcessor.get() != null) {
public void close() { asyncClient.close(); EmitterProcessor<ServiceBusReceivedMessageContext> processor = messageProcessor.getAndSet(null); if (processor != null) { processor.onComplete(); } }
class ServiceBusReceiverClient implements AutoCloseable { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverClient.class); private final AtomicInteger idGenerator = new AtomicInteger(); private final ServiceBusReceiverAsyncClient asyncClient; private final Duration operationTimeout; private static ...
class ServiceBusReceiverClient implements AutoCloseable { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverClient.class); private final AtomicInteger idGenerator = new AtomicInteger(); private final ServiceBusReceiverAsyncClient asyncClient; private final Duration operationTimeout; private final O...
Search is validating `apiKeyCredential.getKey` empty or null case.
public FormRecognizerClientBuilder credential(AzureKeyCredential apiKeyCredential) { this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null."); return this; }
this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null.");
public FormRecognizerClientBuilder credential(AzureKeyCredential apiKeyCredential) { this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null."); return this; }
class FormRecognizerClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER_VALUE = ContentType.APPLICATION_JSON; private static final String ACCEPT_HEADER = "Accept"; private static final String FORM_RECOGNIZER_PROPERTIES = "...
class FormRecognizerClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER_VALUE = ContentType.APPLICATION_JSON; private static final String ACCEPT_HEADER = "Accept"; private static final String FORM_RECOGNIZER_PROPERTIES = "...
commented code should be removed.
public IterableStream<ServiceBusReceivedMessageContext> receive(int maxMessages, Duration maxWaitTime) { if (maxMessages <= 0) { throw logger.logExceptionAsError(new IllegalArgumentException( "'maxMessages' cannot be less than or equal to 0. maxMessages: " + maxMessages)); } else if (Objects.isNull(maxWaitTime)) { thro...
public IterableStream<ServiceBusReceivedMessageContext> receive(int maxMessages, Duration maxWaitTime) { if (maxMessages <= 0) { throw logger.logExceptionAsError(new IllegalArgumentException( "'maxMessages' cannot be less than or equal to 0. maxMessages: " + maxMessages)); } else if (Objects.isNull(maxWaitTime)) { thro...
class ServiceBusReceiverClient implements AutoCloseable { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverClient.class); private final AtomicInteger idGenerator = new AtomicInteger(); private final ServiceBusReceiverAsyncClient asyncClient; private final Duration operationTimeout; private static ...
class ServiceBusReceiverClient implements AutoCloseable { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverClient.class); private final AtomicInteger idGenerator = new AtomicInteger(); private final ServiceBusReceiverAsyncClient asyncClient; private final Duration operationTimeout; private final O...
Between `isDisposed()` check and `dispose()` the processor might have changed state. This is not an atomic operation, if that's what you were trying to achieve using the AtomicReference.
public void close() { asyncClient.close(); if (messageProcessor.get() != null && !messageProcessor.get().isDisposed()) { messageProcessor.get().dispose(); } Disposable activeSubscription = messageProcessorSubscription.get(); if (activeSubscription != null && !activeSubscription.isDisposed()) { activeSubscription.dispos...
}
public void close() { asyncClient.close(); EmitterProcessor<ServiceBusReceivedMessageContext> processor = messageProcessor.getAndSet(null); if (processor != null) { processor.onComplete(); } }
class ServiceBusReceiverClient implements AutoCloseable { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverClient.class); private final AtomicInteger idGenerator = new AtomicInteger(); private final ServiceBusReceiverAsyncClient asyncClient; private final Duration operationTimeout; private static ...
class ServiceBusReceiverClient implements AutoCloseable { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverClient.class); private final AtomicInteger idGenerator = new AtomicInteger(); private final ServiceBusReceiverAsyncClient asyncClient; private final Duration operationTimeout; private final O...
Same here, this is not an atomic operation.
public void close() { asyncClient.close(); if (messageProcessor.get() != null && !messageProcessor.get().isDisposed()) { messageProcessor.get().dispose(); } Disposable activeSubscription = messageProcessorSubscription.get(); if (activeSubscription != null && !activeSubscription.isDisposed()) { activeSubscription.dispos...
}
public void close() { asyncClient.close(); EmitterProcessor<ServiceBusReceivedMessageContext> processor = messageProcessor.getAndSet(null); if (processor != null) { processor.onComplete(); } }
class ServiceBusReceiverClient implements AutoCloseable { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverClient.class); private final AtomicInteger idGenerator = new AtomicInteger(); private final ServiceBusReceiverAsyncClient asyncClient; private final Duration operationTimeout; private static ...
class ServiceBusReceiverClient implements AutoCloseable { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverClient.class); private final AtomicInteger idGenerator = new AtomicInteger(); private final ServiceBusReceiverAsyncClient asyncClient; private final Duration operationTimeout; private final O...
The operation should be `cancel()`, not `onComplete()`. onComplete and methods like that should be done through a sink. ```java var processor = messageProcessor.getAndSet(null); if (processor != null) { processor.cancel() } ```
public void close() { asyncClient.close(); if (messageProcessor.get() != null) { messageProcessor.get().onComplete(); } }
if (messageProcessor.get() != null) {
public void close() { asyncClient.close(); EmitterProcessor<ServiceBusReceivedMessageContext> processor = messageProcessor.getAndSet(null); if (processor != null) { processor.onComplete(); } }
class ServiceBusReceiverClient implements AutoCloseable { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverClient.class); private final AtomicInteger idGenerator = new AtomicInteger(); private final ServiceBusReceiverAsyncClient asyncClient; private final Duration operationTimeout; private static ...
class ServiceBusReceiverClient implements AutoCloseable { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverClient.class); private final AtomicInteger idGenerator = new AtomicInteger(); private final ServiceBusReceiverAsyncClient asyncClient; private final Duration operationTimeout; private final O...
Moreover, if the credential is required, we can move the validation up to buildClient()
public FormRecognizerClientBuilder credential(AzureKeyCredential apiKeyCredential) { this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null."); return this; }
this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null.");
public FormRecognizerClientBuilder credential(AzureKeyCredential apiKeyCredential) { this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null."); return this; }
class FormRecognizerClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER_VALUE = ContentType.APPLICATION_JSON; private static final String ACCEPT_HEADER = "Accept"; private static final String FORM_RECOGNIZER_PROPERTIES = "...
class FormRecognizerClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER_VALUE = ContentType.APPLICATION_JSON; private static final String ACCEPT_HEADER = "Accept"; private static final String FORM_RECOGNIZER_PROPERTIES = "...
discussed on teams and decided to not change it.
public void close() { asyncClient.close(); if (messageProcessor.get() != null) { messageProcessor.get().onComplete(); } }
if (messageProcessor.get() != null) {
public void close() { asyncClient.close(); EmitterProcessor<ServiceBusReceivedMessageContext> processor = messageProcessor.getAndSet(null); if (processor != null) { processor.onComplete(); } }
class ServiceBusReceiverClient implements AutoCloseable { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverClient.class); private final AtomicInteger idGenerator = new AtomicInteger(); private final ServiceBusReceiverAsyncClient asyncClient; private final Duration operationTimeout; private static ...
class ServiceBusReceiverClient implements AutoCloseable { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverClient.class); private final AtomicInteger idGenerator = new AtomicInteger(); private final ServiceBusReceiverAsyncClient asyncClient; private final Duration operationTimeout; private final O...
It does have that here - https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerClientBuilder.java#L181
public FormRecognizerClientBuilder credential(AzureKeyCredential apiKeyCredential) { this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null."); return this; }
this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null.");
public FormRecognizerClientBuilder credential(AzureKeyCredential apiKeyCredential) { this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null."); return this; }
class FormRecognizerClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER_VALUE = ContentType.APPLICATION_JSON; private static final String ACCEPT_HEADER = "Accept"; private static final String FORM_RECOGNIZER_PROPERTIES = "...
class FormRecognizerClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER_VALUE = ContentType.APPLICATION_JSON; private static final String ACCEPT_HEADER = "Accept"; private static final String FORM_RECOGNIZER_PROPERTIES = "...
``` public SearchServiceClientBuilder credential(AzureKeyCredential keyCredential) { if (keyCredential == null) { throw logger.logExceptionAsError(new NullPointerException("'keyCredential' cannot be null.")); } if (CoreUtils.isNullOrEmpty(keyCredential.getKey())) { th...
public FormRecognizerClientBuilder credential(AzureKeyCredential apiKeyCredential) { this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null."); return this; }
this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null.");
public FormRecognizerClientBuilder credential(AzureKeyCredential apiKeyCredential) { this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null."); return this; }
class FormRecognizerClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER_VALUE = ContentType.APPLICATION_JSON; private static final String ACCEPT_HEADER = "Accept"; private static final String FORM_RECOGNIZER_PROPERTIES = "...
class FormRecognizerClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER_VALUE = ContentType.APPLICATION_JSON; private static final String ACCEPT_HEADER = "Accept"; private static final String FORM_RECOGNIZER_PROPERTIES = "...
@sima-zhu Could this > if (keyCredential == null) { throw logger.logExceptionAsError(new NullPointerException("'keyCredential' cannot be null.")); } be replaced with > this.credential = Objects.requireNonNull(keyCredential, "'keyCredential' cannot be null."); And also for the rest of the...
public FormRecognizerClientBuilder credential(AzureKeyCredential apiKeyCredential) { this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null."); return this; }
this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null.");
public FormRecognizerClientBuilder credential(AzureKeyCredential apiKeyCredential) { this.credential = Objects.requireNonNull(apiKeyCredential, "'apiKeyCredential' cannot be null."); return this; }
class FormRecognizerClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER_VALUE = ContentType.APPLICATION_JSON; private static final String ACCEPT_HEADER = "Accept"; private static final String FORM_RECOGNIZER_PROPERTIES = "...
class FormRecognizerClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER_VALUE = ContentType.APPLICATION_JSON; private static final String ACCEPT_HEADER = "Accept"; private static final String FORM_RECOGNIZER_PROPERTIES = "...
ChangeFeedProcessor is a read-only, how minimal response impacts it?
public static CosmosAsyncClient getCosmosClient() { return new CosmosClientBuilder() .endpoint(SampleConfigurations.HOST) .key(SampleConfigurations.MASTER_KEY) .connectionPolicy(ConnectionPolicy.getDefaultPolicy()) .consistencyLevel(ConsistencyLevel.EVENTUAL) .returnMinimalResponse(false) .buildAsyncClient(); }
.returnMinimalResponse(false)
public static CosmosAsyncClient getCosmosClient() { return new CosmosClientBuilder() .endpoint(SampleConfigurations.HOST) .key(SampleConfigurations.MASTER_KEY) .connectionPolicy(ConnectionPolicy.getDefaultPolicy()) .consistencyLevel(ConsistencyLevel.EVENTUAL) .contentResponseOnWriteEnabled(true) .buildAsyncClient(); }
class SampleChangeFeedProcessor { public static int WAIT_FOR_WORK = 60; public static final String DATABASE_NAME = "db_" + RandomStringUtils.randomAlphabetic(7); public static final String COLLECTION_NAME = "coll_" + RandomStringUtils.randomAlphabetic(7); private static final ObjectMapper OBJECT_MAPPER = Utils.getSimpl...
class SampleChangeFeedProcessor { public static int WAIT_FOR_WORK = 60; public static final String DATABASE_NAME = "db_" + RandomStringUtils.randomAlphabetic(7); public static final String COLLECTION_NAME = "coll_" + RandomStringUtils.randomAlphabetic(7); private static final ObjectMapper OBJECT_MAPPER = Utils.getSimpl...
good catch.
public HttpTransportClient(Configs configs, Duration requestTimeout, UserAgentContainer userAgent) { this.configs = configs; this.httpClient = createHttpClient(requestTimeout); this.defaultHeaders = new HashMap<>(); this.defaultHeaders.put(HttpConstants.HttpHeaders.VERSION, HttpConstants.Versions.CURRENT_VERSION); this...
this.defaultHeaders.put(HttpConstants.HttpHeaders.CACHE_CONTROL, HttpConstants.HeaderValues.NO_CACHE);
public HttpTransportClient(Configs configs, Duration requestTimeout, UserAgentContainer userAgent) { this.configs = configs; this.httpClient = createHttpClient(requestTimeout); this.defaultHeaders = new HashMap<>(); this.defaultHeaders.put(HttpConstants.HttpHeaders.VERSION, HttpConstants.Versions.CURRENT_VERSION); this...
class HttpTransportClient extends TransportClient { private final Logger logger = LoggerFactory.getLogger(HttpTransportClient.class); private final HttpClient httpClient; private final Map<String, String> defaultHeaders; private final Configs configs; HttpClient createHttpClient(Duration requestTimeout) { HttpClientCon...
class HttpTransportClient extends TransportClient { private final Logger logger = LoggerFactory.getLogger(HttpTransportClient.class); private final HttpClient httpClient; private final Map<String, String> defaultHeaders; private final Configs configs; HttpClient createHttpClient(Duration requestTimeout) { HttpClientCon...
This is SampleChangeFeedProcessor example, which creates some documents before listening to them, so used it. This is not in the source code.
public static CosmosAsyncClient getCosmosClient() { return new CosmosClientBuilder() .endpoint(SampleConfigurations.HOST) .key(SampleConfigurations.MASTER_KEY) .connectionPolicy(ConnectionPolicy.getDefaultPolicy()) .consistencyLevel(ConsistencyLevel.EVENTUAL) .returnMinimalResponse(false) .buildAsyncClient(); }
.returnMinimalResponse(false)
public static CosmosAsyncClient getCosmosClient() { return new CosmosClientBuilder() .endpoint(SampleConfigurations.HOST) .key(SampleConfigurations.MASTER_KEY) .connectionPolicy(ConnectionPolicy.getDefaultPolicy()) .consistencyLevel(ConsistencyLevel.EVENTUAL) .contentResponseOnWriteEnabled(true) .buildAsyncClient(); }
class SampleChangeFeedProcessor { public static int WAIT_FOR_WORK = 60; public static final String DATABASE_NAME = "db_" + RandomStringUtils.randomAlphabetic(7); public static final String COLLECTION_NAME = "coll_" + RandomStringUtils.randomAlphabetic(7); private static final ObjectMapper OBJECT_MAPPER = Utils.getSimpl...
class SampleChangeFeedProcessor { public static int WAIT_FOR_WORK = 60; public static final String DATABASE_NAME = "db_" + RandomStringUtils.randomAlphabetic(7); public static final String COLLECTION_NAME = "coll_" + RandomStringUtils.randomAlphabetic(7); private static final ObjectMapper OBJECT_MAPPER = Utils.getSimpl...
is it the case that when change feed is enabled then storage account will have some special container to store them? so its absence means change-feed-not-enabled?
private Mono<Boolean> validateChangefeed() { return this.client.exists() .flatMap(exists -> { if (exists == null || !exists) { return FluxUtil.monoError(logger, new RuntimeException("Changefeed has not been enabled for " + "this account.")); } return Mono.just(true); }); }
+ "this account."));
private Mono<Boolean> validateChangefeed() { return this.client.exists() .flatMap(exists -> { if (exists == null || !exists) { return FluxUtil.monoError(logger, new RuntimeException("Changefeed has not been enabled for " + "this account.")); } return Mono.just(true); }); }
class Changefeed { private final ClientLogger logger = new ClientLogger(Changefeed.class); private static final String SEGMENT_PREFIX = "idx/segments/"; private static final String METADATA_SEGMENT_PATH = "meta/segments.json"; private static final ObjectMapper mapper = new ObjectMapper(); private final BlobContainerAsy...
class Changefeed { private final ClientLogger logger = new ClientLogger(Changefeed.class); private static final String SEGMENT_PREFIX = "idx/segments/"; private static final String METADATA_SEGMENT_PATH = "meta/segments.json"; private static final ObjectMapper MAPPER = new ObjectMapper(); private final BlobContainerAsy...
The indentation is off here?
void validateUSReceiptData(USReceipt actualRecognizedReceipt, boolean includeTextDetails) { final AnalyzeResult analyzeResult = getAnalyzeRawResponse().getAnalyzeResult(); List<ReadResult> readResults = analyzeResult.getReadResults(); DocumentResult documentResult = analyzeResult.getDocumentResults().get(0); final Map<...
validatePageRangeData(documentResult.getPageRange().get(0), actualRecognizedReceipt.getRecognizedForm().getPageRange());
void validateUSReceiptData(USReceipt actualRecognizedReceipt, boolean includeTextDetails) { final AnalyzeResult analyzeResult = getAnalyzeRawResponse().getAnalyzeResult(); List<ReadResult> readResults = analyzeResult.getReadResults(); DocumentResult documentResult = analyzeResult.getDocumentResults().get(0); final Map<...
class FormRecognizerClientTestBase extends TestBase { private static final String RECEIPT_CONTOSO_JPG = "contoso-allinone.jpg"; private static final String FORM_JPG = "Form_1.jpg"; private static final String INVOICE_PDF = "Invoice_6.pdf"; private static final Pattern NON_DIGIT_PATTERN = Pattern.compile("[^0-9]+"); pri...
class FormRecognizerClientTestBase extends TestBase { private static final String RECEIPT_CONTOSO_JPG = "contoso-allinone.jpg"; private static final String FORM_JPG = "Form_1.jpg"; private static final String INVOICE_PDF = "Invoice_6.pdf"; private static final Pattern NON_DIGIT_PATTERN = Pattern.compile("[^0-9]+"); pri...
does this mean we will create a new client every time before a test?
public void recognizeLayoutInvalidSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); invalidSourceUrlRunner((invalidSourceUrl) -> assertThrows(ErrorResponseException.class, () -> client.beginRecognizeContentFromUrl(invalidSourceU...
client = getFormRecognizerClient(httpClient, serviceVersion);
public void recognizeLayoutInvalidSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); invalidSourceUrlRunner((invalidSourceUrl) -> assertThrows(ErrorResponseException.class, () -> client.beginRecognizeContentFromUrl(invalidSourceU...
class FormRecognizerClientTest extends FormRecognizerClientTestBase { private FormRecognizerClient client; private FormRecognizerClient getFormRecognizerClient(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { FormRecognizerClientBuilder builder = new FormRecognizerClientBuilder() .httpClient(httpCl...
class FormRecognizerClientTest extends FormRecognizerClientTestBase { private FormRecognizerClient client; private FormRecognizerClient getFormRecognizerClient(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { FormRecognizerClientBuilder builder = new FormRecognizerClientBuilder() .endpoint(getEndpo...
Yes, it is a cheap operation and parameterized tests can only set on method level instead of @beforeAll and @before
public void recognizeLayoutInvalidSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); invalidSourceUrlRunner((invalidSourceUrl) -> assertThrows(ErrorResponseException.class, () -> client.beginRecognizeContentFromUrl(invalidSourceU...
client = getFormRecognizerClient(httpClient, serviceVersion);
public void recognizeLayoutInvalidSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); invalidSourceUrlRunner((invalidSourceUrl) -> assertThrows(ErrorResponseException.class, () -> client.beginRecognizeContentFromUrl(invalidSourceU...
class FormRecognizerClientTest extends FormRecognizerClientTestBase { private FormRecognizerClient client; private FormRecognizerClient getFormRecognizerClient(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { FormRecognizerClientBuilder builder = new FormRecognizerClientBuilder() .httpClient(httpCl...
class FormRecognizerClientTest extends FormRecognizerClientTestBase { private FormRecognizerClient client; private FormRecognizerClient getFormRecognizerClient(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { FormRecognizerClientBuilder builder = new FormRecognizerClientBuilder() .endpoint(getEndpo...
Will double check the indentation.
void validateUSReceiptData(USReceipt actualRecognizedReceipt, boolean includeTextDetails) { final AnalyzeResult analyzeResult = getAnalyzeRawResponse().getAnalyzeResult(); List<ReadResult> readResults = analyzeResult.getReadResults(); DocumentResult documentResult = analyzeResult.getDocumentResults().get(0); final Map<...
validatePageRangeData(documentResult.getPageRange().get(0), actualRecognizedReceipt.getRecognizedForm().getPageRange());
void validateUSReceiptData(USReceipt actualRecognizedReceipt, boolean includeTextDetails) { final AnalyzeResult analyzeResult = getAnalyzeRawResponse().getAnalyzeResult(); List<ReadResult> readResults = analyzeResult.getReadResults(); DocumentResult documentResult = analyzeResult.getDocumentResults().get(0); final Map<...
class FormRecognizerClientTestBase extends TestBase { private static final String RECEIPT_CONTOSO_JPG = "contoso-allinone.jpg"; private static final String FORM_JPG = "Form_1.jpg"; private static final String INVOICE_PDF = "Invoice_6.pdf"; private static final Pattern NON_DIGIT_PATTERN = Pattern.compile("[^0-9]+"); pri...
class FormRecognizerClientTestBase extends TestBase { private static final String RECEIPT_CONTOSO_JPG = "contoso-allinone.jpg"; private static final String FORM_JPG = "Form_1.jpg"; private static final String INVOICE_PDF = "Invoice_6.pdf"; private static final Pattern NON_DIGIT_PATTERN = Pattern.compile("[^0-9]+"); pri...
indentation revert?
void validateUSReceiptData(USReceipt actualRecognizedReceipt, boolean includeTextDetails) { final AnalyzeResult analyzeResult = getAnalyzeRawResponse().getAnalyzeResult(); List<ReadResult> readResults = analyzeResult.getReadResults(); DocumentResult documentResult = analyzeResult.getDocumentResults().get(0); final Map<...
validateFieldValueTransforms(expectedReceiptFields.get("Tax"), actualRecognizedReceipt.getTax(), readResults,
void validateUSReceiptData(USReceipt actualRecognizedReceipt, boolean includeTextDetails) { final AnalyzeResult analyzeResult = getAnalyzeRawResponse().getAnalyzeResult(); List<ReadResult> readResults = analyzeResult.getReadResults(); DocumentResult documentResult = analyzeResult.getDocumentResults().get(0); final Map<...
class FormRecognizerClientTestBase extends TestBase { private static final String RECEIPT_CONTOSO_JPG = "contoso-allinone.jpg"; private static final String FORM_JPG = "Form_1.jpg"; private static final String INVOICE_PDF = "Invoice_6.pdf"; private static final Pattern NON_DIGIT_PATTERN = Pattern.compile("[^0-9]+"); pri...
class FormRecognizerClientTestBase extends TestBase { private static final String RECEIPT_CONTOSO_JPG = "contoso-allinone.jpg"; private static final String FORM_JPG = "Form_1.jpg"; private static final String INVOICE_PDF = "Invoice_6.pdf"; private static final Pattern NON_DIGIT_PATTERN = Pattern.compile("[^0-9]+"); pri...
What if we requested 100 events, only 30 showed up in the timeout period, and the next work item wants 10? This logic will add another 10 credits (making it 80 credits) even though we don't need to add more credits to the link.
private void drainQueue() { if (isTerminated()) { return; } currentWork = workQueue.poll(); if (currentWork == null) { return; } subscription.request(currentWork.getNumberOfEvents()); timeoutOperation = Mono.delay(currentWork.getTimeout()) .subscribe(l -> { if (!currentWork.isTerminal()) { completeCurrentWork(currentWo...
subscription.request(currentWork.getNumberOfEvents());
private void drainQueue() { if (isTerminated()) { return; } synchronized (currentWorkLock) { if (currentWork != null && currentWork.isTerminal()) { workQueue.remove(currentWork); if (currentTimeoutOperation != null && !currentTimeoutOperation.isDisposed()) { currentTimeoutOperation.dispose(); } currentTimeoutOperation ...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final long prefetch; private final AtomicInteger wip = new AtomicI...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
Example: When there is only one receive(2) request and it time out. But we got two messages after that. During this time we also got request for another receive(2) . In this case we can use this buffer to send the messages and do not need to ask upstream.
protected void hookOnNext(ServiceBusReceivedMessageContext message) { if (currentWork == null) { bufferMessages.add(message); return; } currentWork.next(message); remaining.decrementAndGet(); if (currentWork.isTerminal()) { currentWork.complete(); if (timeoutOperation != null && !timeoutOperation.isDisposed()) { timeou...
bufferMessages.add(message);
protected void hookOnNext(ServiceBusReceivedMessageContext message) { bufferMessages.add(message); drain(); }
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final long prefetch; private final AtomicInteger wip = new AtomicI...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
This can be verbose. It'll get noisy.
protected void hookOnSubscribe(Subscription subscription) { this.subscription = subscription; logger.info("[{}] onSubscribe Pending: {}, Scheduling receive timeout task '{}'.", initialWork.getId(), initialWork.getNumberOfEvents(), initialWork.getTimeout()); queueWork(initialWork); }
logger.info("[{}] onSubscribe Pending: {}, Scheduling receive timeout task '{}'.", initialWork.getId(),
protected void hookOnSubscribe(Subscription subscription) { if (Operators.setOnce(UPSTREAM, this, subscription)) { this.subscription = subscription; remaining.addAndGet(requested); subscription.request(requested); subscriberInitialized = true; drain(); } else { logger.error("Already subscribed once."); } }
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final long prefetch; private final AtomicInteger wip = new AtomicI...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
Space after `//`: `// Boundary....`
protected void hookOnNext(ServiceBusReceivedMessageContext message) { if (currentWork == null) { bufferMessages.add(message); return; } currentWork.next(message); remaining.decrementAndGet(); if (currentWork.isTerminal()) { currentWork.complete(); if (timeoutOperation != null && !timeoutOperation.isDisposed()) { timeou...
protected void hookOnNext(ServiceBusReceivedMessageContext message) { bufferMessages.add(message); drain(); }
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final long prefetch; private final AtomicInteger wip = new AtomicI...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
you never use the prefetch: ``` subscription.request(prefetch); ```
protected void hookOnSubscribe(Subscription subscription) { this.subscription = subscription; logger.verbose("[{}] onSubscribe Pending: {}, Scheduling receive timeout task '{}'.", initialWork.getId(), initialWork.getNumberOfEvents(), initialWork.getTimeout()); queueWork(initialWork); }
protected void hookOnSubscribe(Subscription subscription) { if (Operators.setOnce(UPSTREAM, this, subscription)) { this.subscription = subscription; remaining.addAndGet(requested); subscription.request(requested); subscriberInitialized = true; drain(); } else { logger.error("Already subscribed once."); } }
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final long prefetch; private final AtomicInteger wip = new AtomicI...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
The comment I was trying to make about WIP is to use it **only** for if someone is clearing the queue and to control access to the `drainQueue` method. You also modify this value in `hookOnNext`, but never decrement it when we exit the `drainQueue` method. ```java private void drain() { // If someone is al...
private void drain() { if (workQueue.size() == 0) { return; } if (!wip.compareAndSet(0, 1)) { return; } drainQueue(); }
private void drain() { if (!wip.compareAndSet(0, 1)) { return; } try { drainQueue(); } finally { final int decremented = wip.decrementAndGet(); if (decremented != 0) { logger.warning("There should be 0, but was: {}", decremented); } } }
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final long prefetch; private final AtomicInteger wip = new AtomicI...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
Do you need this variable? if the subscription != null, I'll assume there is an upstream. Also, if we call hookonSubscribe twice, it'll stomp over the previous subscription. We should guard against this by only setting it when it is null and erroring when someone wants to set it again. You'll see a setOnce in some of...
protected void hookOnSubscribe(Subscription subscription) { this.subscription = subscription; remaining.addAndGet(requested); subscription.request(requested); subscriberInitialized = true; drain(); }
this.subscription = subscription;
protected void hookOnSubscribe(Subscription subscription) { if (Operators.setOnce(UPSTREAM, this, subscription)) { this.subscription = subscription; remaining.addAndGet(requested); subscription.request(requested); subscriberInitialized = true; drain(); } else { logger.error("Already subscribed once."); } }
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
Is there any benefit to setting this to null again (and in a few places)? Once a subscription is disposed calling dispose again is a no-op.
private void drainQueue() { if (isTerminated()) { return; } synchronized (currentWorkLock) { if (currentWork != null && currentWork.isTerminal()) { workQueue.remove(currentWork); if (currentTimeoutOperation != null & !currentTimeoutOperation.isDisposed()) { currentTimeoutOperation.dispose(); } currentTimeoutOperation =...
currentTimeoutOperation = null;
private void drainQueue() { if (isTerminated()) { return; } synchronized (currentWorkLock) { if (currentWork != null && currentWork.isTerminal()) { workQueue.remove(currentWork); if (currentTimeoutOperation != null && !currentTimeoutOperation.isDisposed()) { currentTimeoutOperation.dispose(); } currentTimeoutOperation ...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
Having a current work is always tied to a timeout operation. Checking currentWork != null should be enough.
private void drainQueue() { if (isTerminated()) { return; } synchronized (currentWorkLock) { if (currentWork != null && currentWork.isTerminal()) { workQueue.remove(currentWork); if (currentTimeoutOperation != null & !currentTimeoutOperation.isDisposed()) { currentTimeoutOperation.dispose(); } currentTimeoutOperation =...
currentTimeoutOperation = null;
private void drainQueue() { if (isTerminated()) { return; } synchronized (currentWorkLock) { if (currentWork != null && currentWork.isTerminal()) { workQueue.remove(currentWork); if (currentTimeoutOperation != null && !currentTimeoutOperation.isDisposed()) { currentTimeoutOperation.dispose(); } currentTimeoutOperation ...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
We might pick currentWork more than one time from workQueue. `currentTimeoutOperation == null` will indicate that are we picking up first time. We do not need to process currentWork if is picked up second time and no bufferMessages to send to it. `while ((currentWork = workQueue.peek()) != null && (currentTimeout...
private void drainQueue() { if (isTerminated()) { return; } synchronized (currentWorkLock) { if (currentWork != null && currentWork.isTerminal()) { workQueue.remove(currentWork); if (currentTimeoutOperation != null & !currentTimeoutOperation.isDisposed()) { currentTimeoutOperation.dispose(); } currentTimeoutOperation =...
currentTimeoutOperation = null;
private void drainQueue() { if (isTerminated()) { return; } synchronized (currentWorkLock) { if (currentWork != null && currentWork.isTerminal()) { workQueue.remove(currentWork); if (currentTimeoutOperation != null && !currentTimeoutOperation.isDisposed()) { currentTimeoutOperation.dispose(); } currentTimeoutOperation ...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
class SynchronousMessageSubscriber extends BaseSubscriber<ServiceBusReceivedMessageContext> { private final ClientLogger logger = new ClientLogger(SynchronousMessageSubscriber.class); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final AtomicInteger wip = new AtomicInteger(); private final Queue...
yup, will address some of the name changes in another PR.
public void getModelInfos() { formTrainingAsyncClient.getModelInfos().subscribe(customModel -> System.out.printf("Model Id: %s, Model status: %s, Created on: %s, Last updated on: %s.%n", customModel.getModelId(), customModel.getStatus(), customModel.getCreatedOn(), customModel.getLastUpdatedOn())); }
public void getModelInfos() { formTrainingAsyncClient.getModelInfos().subscribe(customModel -> System.out.printf("Model Id: %s, Model status: %s, Created on: %s, Last updated on: %s.%n", customModel.getModelId(), customModel.getStatus(), customModel.getCreatedOn(), customModel.getLastUpdatedOn())); }
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
Do these tests are always expected to run in Direct mode?
public void before_UniqueIndexTest() { client = new CosmosClientBuilder() .endpoint(TestConfigurations.HOST) .key(TestConfigurations.MASTER_KEY) .directMode(DirectConnectionConfig.getDefaultConfig()) .consistencyLevel(ConsistencyLevel.SESSION) .contentResponseOnWriteEnabled(true) .buildAsyncClient(); database = createD...
.directMode(DirectConnectionConfig.getDefaultConfig())
public void before_UniqueIndexTest() { client = new CosmosClientBuilder() .endpoint(TestConfigurations.HOST) .key(TestConfigurations.MASTER_KEY) .directMode(DirectConnectionConfig.getDefaultConfig()) .consistencyLevel(ConsistencyLevel.SESSION) .contentResponseOnWriteEnabled(true) .buildAsyncClient(); database = createD...
class UniqueIndexTest extends TestSuiteBase { protected static final int TIMEOUT = 30000; protected static final int SETUP_TIMEOUT = 20000; protected static final int SHUTDOWN_TIMEOUT = 20000; private final String databaseId = CosmosDatabaseForTest.generateId(); private CosmosAsyncClient client; private CosmosAsyncData...
class UniqueIndexTest extends TestSuiteBase { protected static final int TIMEOUT = 30000; protected static final int SETUP_TIMEOUT = 20000; protected static final int SHUTDOWN_TIMEOUT = 20000; private final String databaseId = CosmosDatabaseForTest.generateId(); private CosmosAsyncClient client; private CosmosAsyncData...
Yes, I have not changed the connection mode of the tests - they will run as it is as they were running earlier. Since earlier also, default was DIRECT mode.
public void before_UniqueIndexTest() { client = new CosmosClientBuilder() .endpoint(TestConfigurations.HOST) .key(TestConfigurations.MASTER_KEY) .directMode(DirectConnectionConfig.getDefaultConfig()) .consistencyLevel(ConsistencyLevel.SESSION) .contentResponseOnWriteEnabled(true) .buildAsyncClient(); database = createD...
.directMode(DirectConnectionConfig.getDefaultConfig())
public void before_UniqueIndexTest() { client = new CosmosClientBuilder() .endpoint(TestConfigurations.HOST) .key(TestConfigurations.MASTER_KEY) .directMode(DirectConnectionConfig.getDefaultConfig()) .consistencyLevel(ConsistencyLevel.SESSION) .contentResponseOnWriteEnabled(true) .buildAsyncClient(); database = createD...
class UniqueIndexTest extends TestSuiteBase { protected static final int TIMEOUT = 30000; protected static final int SETUP_TIMEOUT = 20000; protected static final int SHUTDOWN_TIMEOUT = 20000; private final String databaseId = CosmosDatabaseForTest.generateId(); private CosmosAsyncClient client; private CosmosAsyncData...
class UniqueIndexTest extends TestSuiteBase { protected static final int TIMEOUT = 30000; protected static final int SETUP_TIMEOUT = 20000; protected static final int SHUTDOWN_TIMEOUT = 20000; private final String databaseId = CosmosDatabaseForTest.generateId(); private CosmosAsyncClient client; private CosmosAsyncData...
don't return a singleton object otherwise, changing it once for one client may affect other clients too. ```suggestion return new GatewayConnectionConfig() ```
public static GatewayConnectionConfig getDefaultConfig() { return GatewayConnectionConfig.defaultConfig; }
return GatewayConnectionConfig.defaultConfig;
public static GatewayConnectionConfig getDefaultConfig() { return new GatewayConnectionConfig(); }
class GatewayConnectionConfig { private static final GatewayConnectionConfig defaultConfig = new GatewayConnectionConfig(); private Duration requestTimeout; private int maxPoolSize; private Duration idleConnectionTimeout; private InetSocketAddress inetSocketProxyAddress; /** * Constructor. */ public GatewayConnectionCo...
class GatewayConnectionConfig { private static final Duration DEFAULT_REQUEST_TIMEOUT = Duration.ofSeconds(60); private static final Duration DEFAULT_IDLE_CONNECTION_TIMEOUT = Duration.ofSeconds(60); private static final int DEFAULT_MAX_POOL_SIZE = 1000; private Duration requestTimeout; private int maxConnectionPoolSiz...
don't return a static singleton instance otherwise changing the default for one client may affect the other client defaults too. ```suggestion return new DirectConnectoinConfig() ```
public static DirectConnectionConfig getDefaultConfig() { return DirectConnectionConfig.defaultConfig; }
return DirectConnectionConfig.defaultConfig;
public static DirectConnectionConfig getDefaultConfig() { return new DirectConnectionConfig(); }
class DirectConnectionConfig { private static final Duration DEFAULT_IDLE_CHANNEL_TIMEOUT = Duration.ZERO; private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); private static final int DEFAULT_MAX_CHANNELS_PER_ENDPOINT = 30; private static final int DEFAULT_MAX_REQUESTS_PER_ENDPOINT = ...
class DirectConnectionConfig { private static final Duration DEFAULT_IDLE_CHANNEL_TIMEOUT = Duration.ZERO; private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); private static final int DEFAULT_MAX_CHANNELS_PER_ENDPOINT = 30; private static final int DEFAULT_MAX_REQUESTS_PER_ENDPOINT = ...
```suggestion endpointDiscoveryEnabled ```
public static CosmosClientBuilder cloneCosmosClientBuilder(CosmosClientBuilder builder) { CosmosClientBuilder copy = new CosmosClientBuilder(); copy.endpoint(builder.getEndpoint()) .key(builder.getKey()) .directMode(builder.getDirectConnectionConfig()) .gatewayMode(builder.getGatewayConnectionConfig()) .consistencyLeve...
.endpointDiscoverEnabled(builder.isEndpointDiscoveryEnabled())
public static CosmosClientBuilder cloneCosmosClientBuilder(CosmosClientBuilder builder) { CosmosClientBuilder copy = new CosmosClientBuilder(); copy.endpoint(builder.getEndpoint()) .key(builder.getKey()) .directMode(builder.getDirectConnectionConfig()) .gatewayMode(builder.getGatewayConnectionConfig()) .consistencyLeve...
class CosmosBridgeInternal { public static AsyncDocumentClient getAsyncDocumentClient(CosmosClient client) { return client.asyncClient().getDocClientWrapper(); } public static AsyncDocumentClient getAsyncDocumentClient(CosmosAsyncClient client) { return client.getDocClientWrapper(); } public static AsyncDocumentClient ...
class CosmosBridgeInternal { public static AsyncDocumentClient getAsyncDocumentClient(CosmosClient client) { return client.asyncClient().getDocClientWrapper(); } public static AsyncDocumentClient getAsyncDocumentClient(CosmosAsyncClient client) { return client.getDocClientWrapper(); } public static AsyncDocumentClient ...
Yes, makes sense.
public static GatewayConnectionConfig getDefaultConfig() { return GatewayConnectionConfig.defaultConfig; }
return GatewayConnectionConfig.defaultConfig;
public static GatewayConnectionConfig getDefaultConfig() { return new GatewayConnectionConfig(); }
class GatewayConnectionConfig { private static final GatewayConnectionConfig defaultConfig = new GatewayConnectionConfig(); private Duration requestTimeout; private int maxPoolSize; private Duration idleConnectionTimeout; private InetSocketAddress inetSocketProxyAddress; /** * Constructor. */ public GatewayConnectionCo...
class GatewayConnectionConfig { private static final Duration DEFAULT_REQUEST_TIMEOUT = Duration.ofSeconds(60); private static final Duration DEFAULT_IDLE_CONNECTION_TIMEOUT = Duration.ofSeconds(60); private static final int DEFAULT_MAX_POOL_SIZE = 1000; private Duration requestTimeout; private int maxConnectionPoolSiz...
Yes, makes sense.
public static DirectConnectionConfig getDefaultConfig() { return DirectConnectionConfig.defaultConfig; }
return DirectConnectionConfig.defaultConfig;
public static DirectConnectionConfig getDefaultConfig() { return new DirectConnectionConfig(); }
class DirectConnectionConfig { private static final Duration DEFAULT_IDLE_CHANNEL_TIMEOUT = Duration.ZERO; private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); private static final int DEFAULT_MAX_CHANNELS_PER_ENDPOINT = 30; private static final int DEFAULT_MAX_REQUESTS_PER_ENDPOINT = ...
class DirectConnectionConfig { private static final Duration DEFAULT_IDLE_CHANNEL_TIMEOUT = Duration.ZERO; private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); private static final int DEFAULT_MAX_CHANNELS_PER_ENDPOINT = 30; private static final int DEFAULT_MAX_REQUESTS_PER_ENDPOINT = ...
Done.
public static CosmosClientBuilder cloneCosmosClientBuilder(CosmosClientBuilder builder) { CosmosClientBuilder copy = new CosmosClientBuilder(); copy.endpoint(builder.getEndpoint()) .key(builder.getKey()) .directMode(builder.getDirectConnectionConfig()) .gatewayMode(builder.getGatewayConnectionConfig()) .consistencyLeve...
.endpointDiscoverEnabled(builder.isEndpointDiscoveryEnabled())
public static CosmosClientBuilder cloneCosmosClientBuilder(CosmosClientBuilder builder) { CosmosClientBuilder copy = new CosmosClientBuilder(); copy.endpoint(builder.getEndpoint()) .key(builder.getKey()) .directMode(builder.getDirectConnectionConfig()) .gatewayMode(builder.getGatewayConnectionConfig()) .consistencyLeve...
class CosmosBridgeInternal { public static AsyncDocumentClient getAsyncDocumentClient(CosmosClient client) { return client.asyncClient().getDocClientWrapper(); } public static AsyncDocumentClient getAsyncDocumentClient(CosmosAsyncClient client) { return client.getDocClientWrapper(); } public static AsyncDocumentClient ...
class CosmosBridgeInternal { public static AsyncDocumentClient getAsyncDocumentClient(CosmosClient client) { return client.asyncClient().getDocClientWrapper(); } public static AsyncDocumentClient getAsyncDocumentClient(CosmosAsyncClient client) { return client.getDocClientWrapper(); } public static AsyncDocumentClient ...
this seems odd, can be closed in last line and then begin .subscribe( from this line.
public void beginTrainingWithOptions() { String trainingSetSource = "{training-set-SAS-URL}"; TrainModelOptions trainModelOptions = new TrainModelOptions().setIncludeSubFolders(false).setPrefix( "Invoice"); formTrainingAsyncClient.beginTraining(trainingSetSource, true, trainModelOptions, Duration.ofSeconds(5) ).subscri...
).subscribe(recognizePollingOperation -> {
public void beginTrainingWithOptions() { String trainingFilesUrl = "{training-set-SAS-URL}"; TrainModelOptions trainModelOptions = new TrainModelOptions().setIncludeSubFolders(false).setPrefix("Invoice"); formTrainingAsyncClient.beginTraining(trainingFilesUrl, true, trainModelOptions, Duration.ofSeconds(5)).subscribe(r...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
nitpick: seems like this spacing isn't as good as how it used to be
public static Mono<ContentType> detectContentType(Flux<ByteBuffer> buffer) { byte[] header = new byte[4]; int[] written = new int[]{0}; ContentType[] contentType = {ContentType.fromString("none")}; return buffer.map(chunk -> { final int len = chunk.remaining(); for (int i = 0; i < len; i++) { header[written[0]] = chunk...
.takeWhile(doContinue -> doContinue)
public static Mono<ContentType> detectContentType(Flux<ByteBuffer> buffer) { byte[] header = new byte[4]; int[] written = new int[]{0}; ContentType[] contentType = {ContentType.fromString("none")}; return buffer.map(chunk -> { final int len = chunk.remaining(); for (int i = 0; i < len; i++) { header[written[0]] = chunk...
class Utility { private static final ClientLogger LOGGER = new ClientLogger(Utility.class); private static final int BYTE_BUFFER_CHUNK_SIZE = 4096; private Utility() { } /** * Automatically detect byte buffer's content type. * <p> * Given the source: <a href="https: * * @param buffer The byte buffer input. * * @return ...
class Utility { private static final ClientLogger LOGGER = new ClientLogger(Utility.class); private static final int BYTE_BUFFER_CHUNK_SIZE = 4096; private Utility() { } /** * Automatically detect byte buffer's content type. * <p> * Given the source: <a href="https: * * @param buffer The byte buffer input. * * @return ...
probably better to change the code snippets to, making it trainingFilesUrl, useTrainingLabels
public void beginTraining() { String trainingSetSource = "{training-set-SAS-URL}"; boolean useLabelFile = true; formTrainingAsyncClient.beginTraining(trainingSetSource, useLabelFile).subscribe( recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(customFormModel -> { System.out.printf("Mo...
formTrainingAsyncClient.beginTraining(trainingSetSource, useLabelFile).subscribe(
public void beginTraining() { String trainingFilesUrl = "{training-set-SAS-URL}"; boolean useTrainingLabels = true; formTrainingAsyncClient.beginTraining(trainingFilesUrl, useTrainingLabels).subscribe( recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(customFormModel -> { System.out.pr...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
maybe you're going to address this in another PR, but from this meeting we also determined to change getModelInfos -> getCustomModels
public void getModelInfos() { formTrainingAsyncClient.getModelInfos().subscribe(customModel -> System.out.printf("Model Id: %s, Model status: %s, Created on: %s, Last updated on: %s.%n", customModel.getModelId(), customModel.getStatus(), customModel.getCreatedOn(), customModel.getLastUpdatedOn())); }
public void getModelInfos() { formTrainingAsyncClient.getModelInfos().subscribe(customModel -> System.out.printf("Model Id: %s, Model status: %s, Created on: %s, Last updated on: %s.%n", customModel.getModelId(), customModel.getStatus(), customModel.getCreatedOn(), customModel.getLastUpdatedOn())); }
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
Yeah, they were correctly formatted now.
public static Mono<ContentType> detectContentType(Flux<ByteBuffer> buffer) { byte[] header = new byte[4]; int[] written = new int[]{0}; ContentType[] contentType = {ContentType.fromString("none")}; return buffer.map(chunk -> { final int len = chunk.remaining(); for (int i = 0; i < len; i++) { header[written[0]] = chunk...
.takeWhile(doContinue -> doContinue)
public static Mono<ContentType> detectContentType(Flux<ByteBuffer> buffer) { byte[] header = new byte[4]; int[] written = new int[]{0}; ContentType[] contentType = {ContentType.fromString("none")}; return buffer.map(chunk -> { final int len = chunk.remaining(); for (int i = 0; i < len; i++) { header[written[0]] = chunk...
class Utility { private static final ClientLogger LOGGER = new ClientLogger(Utility.class); private static final int BYTE_BUFFER_CHUNK_SIZE = 4096; private Utility() { } /** * Automatically detect byte buffer's content type. * <p> * Given the source: <a href="https: * * @param buffer The byte buffer input. * * @return ...
class Utility { private static final ClientLogger LOGGER = new ClientLogger(Utility.class); private static final int BYTE_BUFFER_CHUNK_SIZE = 4096; private Utility() { } /** * Automatically detect byte buffer's content type. * <p> * Given the source: <a href="https: * * @param buffer The byte buffer input. * * @return ...
nit: doesn't need a new line
public void beginTrainingWithOptions() { String trainingFilesUrl = "{training-set-SAS-URL}"; TrainModelOptions trainModelOptions = new TrainModelOptions().setIncludeSubFolders(false) .setPrefix("Invoice"); boolean useTrainingLabels = true; CustomFormModel customFormModel = formTrainingClient.beginTraining( trainingFile...
.setPrefix("Invoice");
public void beginTrainingWithOptions() { String trainingFilesUrl = "{training-set-SAS-URL}"; TrainModelOptions trainModelOptions = new TrainModelOptions().setIncludeSubFolders(false).setPrefix("Invoice"); boolean useTrainingLabels = true; CustomFormModel customFormModel = formTrainingClient.beginTraining(trainingFilesU...
class FormTrainingClientJavaDocCodeSnippets { private FormTrainingClient formTrainingClient = new FormRecognizerClientBuilder().buildClient() .getFormTrainingClient(); /** * Code snippet for {@link FormTrainingClient} initialization */ public void formTrainingClientInInitialization() { FormTrainingClient formTrainingCl...
class FormTrainingClientJavaDocCodeSnippets { private FormTrainingClient formTrainingClient = new FormRecognizerClientBuilder().buildClient() .getFormTrainingClient(); /** * Code snippet for {@link FormTrainingClient} initialization */ public void formTrainingClientInInitialization() { FormTrainingClient formTrainingCl...
We're still leaking the auth token; just because we override the toString(), it will not prevent someone trapping and dumping the exception object via an object mapper or some other serialization method which ignores the toString() override. The initial fix that creates a copy of the request header map is a better one...
public String toString() { return getClass().getSimpleName() + "{" + "error=" + cosmosError + ", resourceAddress='" + resourceAddress + '\'' + ", statusCode=" + statusCode + ", message=" + getMessage() + ", causeInfo=" + causeInfo() + ", responseHeaders=" + responseHeaders + ", requestHeaders=" + filterSensitiveData(re...
+ filterSensitiveData(requestHeaders) + '}';
public String toString() { return getClass().getSimpleName() + "{" + "error=" + cosmosError + ", resourceAddress='" + resourceAddress + '\'' + ", statusCode=" + statusCode + ", message=" + getMessage() + ", causeInfo=" + causeInfo() + ", responseHeaders=" + responseHeaders + ", requestHeaders=" + filterSensitiveData(re...
class CosmosClientException extends AzureException { private static final long serialVersionUID = 1L; private final int statusCode; private final Map<String, String> responseHeaders; private CosmosResponseDiagnostics cosmosResponseDiagnostics; private final RequestTimeline requestTimeline; private CosmosError cosmosErr...
class CosmosClientException extends AzureException { private static final long serialVersionUID = 1L; private final int statusCode; private final Map<String, String> responseHeaders; private CosmosResponseDiagnostics cosmosResponseDiagnostics; private final RequestTimeline requestTimeline; private CosmosError cosmosErr...
what does 0 as idle connection timeout mean?
public DirectConnectionConfig() { this.connectionTimeout = null; this.idleConnectionTimeout = Duration.ZERO; this.idleEndpointTimeout = DEFAULT_IDLE_ENDPOINT_TIMEOUT; this.maxConnectionsPerEndpoint = DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT; this.maxRequestsPerConnection = DEFAULT_MAX_REQUESTS_PER_ENDPOINT; }
this.idleConnectionTimeout = Duration.ZERO;
public DirectConnectionConfig() { this.idleConnectionTimeout = Duration.ZERO; this.connectionTimeout = DEFAULT_CONNECTION_TIMEOUT; this.idleEndpointTimeout = DEFAULT_IDLE_ENDPOINT_TIMEOUT; this.maxConnectionsPerEndpoint = DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT; this.maxRequestsPerConnection = DEFAULT_MAX_REQUESTS_PER_CON...
class DirectConnectionConfig { private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); private static final int DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT = 30; private static final int DEFAULT_MAX_REQUESTS_PER_ENDPOINT = 10; private Duration connectionTimeout; private Duration idleConnectionTi...
class DirectConnectionConfig { private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); private static final Duration DEFAULT_CONNECTION_TIMEOUT = Duration.ofSeconds(60L); private static final int DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT = 30; private static final int DEFAULT_MAX_REQUESTS_PER_...
```java this.connectionTimeout = null; ``` why is this null?
public DirectConnectionConfig() { this.connectionTimeout = null; this.idleConnectionTimeout = Duration.ZERO; this.idleEndpointTimeout = DEFAULT_IDLE_ENDPOINT_TIMEOUT; this.maxConnectionsPerEndpoint = DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT; this.maxRequestsPerConnection = DEFAULT_MAX_REQUESTS_PER_ENDPOINT; }
this.connectionTimeout = null;
public DirectConnectionConfig() { this.idleConnectionTimeout = Duration.ZERO; this.connectionTimeout = DEFAULT_CONNECTION_TIMEOUT; this.idleEndpointTimeout = DEFAULT_IDLE_ENDPOINT_TIMEOUT; this.maxConnectionsPerEndpoint = DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT; this.maxRequestsPerConnection = DEFAULT_MAX_REQUESTS_PER_CON...
class DirectConnectionConfig { private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); private static final int DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT = 30; private static final int DEFAULT_MAX_REQUESTS_PER_ENDPOINT = 10; private Duration connectionTimeout; private Duration idleConnectionTi...
class DirectConnectionConfig { private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); private static final Duration DEFAULT_CONNECTION_TIMEOUT = Duration.ofSeconds(60L); private static final int DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT = 30; private static final int DEFAULT_MAX_REQUESTS_PER_...
I have referred this in docs in `get/set` API.
public DirectConnectionConfig() { this.connectionTimeout = null; this.idleConnectionTimeout = Duration.ZERO; this.idleEndpointTimeout = DEFAULT_IDLE_ENDPOINT_TIMEOUT; this.maxConnectionsPerEndpoint = DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT; this.maxRequestsPerConnection = DEFAULT_MAX_REQUESTS_PER_ENDPOINT; }
this.idleConnectionTimeout = Duration.ZERO;
public DirectConnectionConfig() { this.idleConnectionTimeout = Duration.ZERO; this.connectionTimeout = DEFAULT_CONNECTION_TIMEOUT; this.idleEndpointTimeout = DEFAULT_IDLE_ENDPOINT_TIMEOUT; this.maxConnectionsPerEndpoint = DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT; this.maxRequestsPerConnection = DEFAULT_MAX_REQUESTS_PER_CON...
class DirectConnectionConfig { private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); private static final int DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT = 30; private static final int DEFAULT_MAX_REQUESTS_PER_ENDPOINT = 10; private Duration connectionTimeout; private Duration idleConnectionTi...
class DirectConnectionConfig { private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); private static final Duration DEFAULT_CONNECTION_TIMEOUT = Duration.ofSeconds(60L); private static final int DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT = 30; private static final int DEFAULT_MAX_REQUESTS_PER_...
will get rid of the redundant initializer.
public DirectConnectionConfig() { this.connectionTimeout = null; this.idleConnectionTimeout = Duration.ZERO; this.idleEndpointTimeout = DEFAULT_IDLE_ENDPOINT_TIMEOUT; this.maxConnectionsPerEndpoint = DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT; this.maxRequestsPerConnection = DEFAULT_MAX_REQUESTS_PER_ENDPOINT; }
this.connectionTimeout = null;
public DirectConnectionConfig() { this.idleConnectionTimeout = Duration.ZERO; this.connectionTimeout = DEFAULT_CONNECTION_TIMEOUT; this.idleEndpointTimeout = DEFAULT_IDLE_ENDPOINT_TIMEOUT; this.maxConnectionsPerEndpoint = DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT; this.maxRequestsPerConnection = DEFAULT_MAX_REQUESTS_PER_CON...
class DirectConnectionConfig { private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); private static final int DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT = 30; private static final int DEFAULT_MAX_REQUESTS_PER_ENDPOINT = 10; private Duration connectionTimeout; private Duration idleConnectionTi...
class DirectConnectionConfig { private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); private static final Duration DEFAULT_CONNECTION_TIMEOUT = Duration.ofSeconds(60L); private static final int DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT = 30; private static final int DEFAULT_MAX_REQUESTS_PER_...
I don't quite know why [this sample code](https://github.com/Azure/azure-service-bus/blob/08df9251dd93d40e087372671b11a562686859cb/samples/Java/azure-servicebus/QueuesWithProxy/src/main/java/com/microsoft/azure/servicebus/samples/queueswithproxy/QueuesWithProxy.java) has this line. Since I am using localhost and the ho...
public void managementClientWithProxy() throws InterruptedException, ServiceBusException { String proxyHostName = "127.0.0.1"; int proxyPort = 8888; final ProxySelector systemDefaultSelector = ProxySelector.getDefault(); ProxySelector.setDefault(new ProxySelector() { @Override public List<Proxy> select(URI uri) { if (u...
public void managementClientWithProxy() throws Exception { String proxyHostName = "127.0.0.1"; int proxyPort = 8888; final ProxySelector systemDefaultSelector = ProxySelector.getDefault(); ProxySelector.setDefault(new ProxySelector() { @Override public List<Proxy> select(URI uri) { if (uri != null && uri.getHost() != n...
class ManagementClientProxyTest { @Test }
class ManagementClientProxyTest { @Ignore @Test private void waitForEnter(int seconds) { ExecutorService executor = Executors.newCachedThreadPool(); try { executor.invokeAny(Arrays.asList(() -> { System.in.read(); return 0; }, () -> { Thread.sleep(seconds * 1000); return 0; })); } catch (Exception e) { } } }
I am wondering if it may be easier/better to set the properties in the client that enables the integration with the default mechanisms that Java networking uses for proxy configuration - documented [here](https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html). ```suggestion .setUseP...
public ManagementClientAsync(URI namespaceEndpointURI, ClientSettings clientSettings) { this.namespaceEndpointURI = namespaceEndpointURI; this.clientSettings = clientSettings; DefaultAsyncHttpClientConfig.Builder clientBuilder = Dsl.config() .setConnectTimeout((int) CONNECTION_TIMEOUT.toMillis()) .setRequestTimeout((in...
}
public ManagementClientAsync(URI namespaceEndpointURI, ClientSettings clientSettings) { this.namespaceEndpointURI = namespaceEndpointURI; this.clientSettings = clientSettings; DefaultAsyncHttpClientConfig.Builder clientBuilder = Dsl.config() .setConnectTimeout((int) CONNECTION_TIMEOUT.toMillis()) .setUseProxySelector(t...
class ManagementClientAsync { private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(ManagementClientAsync.class); private static final int ONE_BOX_HTTPS_PORT = 4446; private static final String API_VERSION_QUERY = "api-version=2017-04"; private static final String USER_AGENT_HEADER_NAME = "User-Agent"; pri...
class ManagementClientAsync { private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(ManagementClientAsync.class); private static final int ONE_BOX_HTTPS_PORT = 4446; private static final String API_VERSION_QUERY = "api-version=2017-04"; private static final String USER_AGENT_HEADER_NAME = "User-Agent"; pri...
@giventocode Thanks for pointing to this resource to offer more background. I verified that this change would have the same impact: select the default proxy set by ProxySelector, this is also what I was trying to do in my changes but don't aware that there are already system level support built into Java. I also verifi...
public ManagementClientAsync(URI namespaceEndpointURI, ClientSettings clientSettings) { this.namespaceEndpointURI = namespaceEndpointURI; this.clientSettings = clientSettings; DefaultAsyncHttpClientConfig.Builder clientBuilder = Dsl.config() .setConnectTimeout((int) CONNECTION_TIMEOUT.toMillis()) .setRequestTimeout((in...
}
public ManagementClientAsync(URI namespaceEndpointURI, ClientSettings clientSettings) { this.namespaceEndpointURI = namespaceEndpointURI; this.clientSettings = clientSettings; DefaultAsyncHttpClientConfig.Builder clientBuilder = Dsl.config() .setConnectTimeout((int) CONNECTION_TIMEOUT.toMillis()) .setUseProxySelector(t...
class ManagementClientAsync { private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(ManagementClientAsync.class); private static final int ONE_BOX_HTTPS_PORT = 4446; private static final String API_VERSION_QUERY = "api-version=2017-04"; private static final String USER_AGENT_HEADER_NAME = "User-Agent"; pri...
class ManagementClientAsync { private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(ManagementClientAsync.class); private static final int ONE_BOX_HTTPS_PORT = 4446; private static final String API_VERSION_QUERY = "api-version=2017-04"; private static final String USER_AGENT_HEADER_NAME = "User-Agent"; pri...
```suggestion TokenCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); ```
public void useAadAsyncClient() { DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() .endpoint("{endpoint}") .credential(defaultCredential) .buildAsyncClient(); }
DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().build();
public void useAadAsyncClient() { TokenCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() .endpoint("{endpoint}") .credential(defaultCredential) .buildAsyncClient(); }
class ReadmeSamples { private TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for configuring http client. */ public void configureHttpClient() { HttpClient client = new NettyAsyncHttpClientBuilder() .port(8080) .wiretap(true) .build(); } /** * Code snippet f...
class ReadmeSamples { private TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for configuring http client. */ public void configureHttpClient() { HttpClient client = new NettyAsyncHttpClientBuilder() .port(8080) .wiretap(true) .build(); } /** * Code snippet f...
Thanks for the additional insights. I further reviewed the code and in a nutshell: if there's a proxy selector, the proxy uri is retrieved from it and then is set explicitly as the proxy server to use. So a few things to consider: - One of the benefits of implementing a proxy selector is that it allows you to filte...
public ManagementClientAsync(URI namespaceEndpointURI, ClientSettings clientSettings) { this.namespaceEndpointURI = namespaceEndpointURI; this.clientSettings = clientSettings; DefaultAsyncHttpClientConfig.Builder clientBuilder = Dsl.config() .setConnectTimeout((int) CONNECTION_TIMEOUT.toMillis()) .setRequestTimeout((in...
}
public ManagementClientAsync(URI namespaceEndpointURI, ClientSettings clientSettings) { this.namespaceEndpointURI = namespaceEndpointURI; this.clientSettings = clientSettings; DefaultAsyncHttpClientConfig.Builder clientBuilder = Dsl.config() .setConnectTimeout((int) CONNECTION_TIMEOUT.toMillis()) .setUseProxySelector(t...
class ManagementClientAsync { private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(ManagementClientAsync.class); private static final int ONE_BOX_HTTPS_PORT = 4446; private static final String API_VERSION_QUERY = "api-version=2017-04"; private static final String USER_AGENT_HEADER_NAME = "User-Agent"; pri...
class ManagementClientAsync { private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(ManagementClientAsync.class); private static final int ONE_BOX_HTTPS_PORT = 4446; private static final String API_VERSION_QUERY = "api-version=2017-04"; private static final String USER_AGENT_HEADER_NAME = "User-Agent"; pri...
I have discussed with @giventocode offline and we have decided to add both `.setUseProxySelector(true)` (compatible with AMQP websockets to use ProxySelector for send/receive operations) and `.setUseProxyProperties(true)` (users can use the Java standard way of setting the proxies and extending how proxies are used pro...
public ManagementClientAsync(URI namespaceEndpointURI, ClientSettings clientSettings) { this.namespaceEndpointURI = namespaceEndpointURI; this.clientSettings = clientSettings; DefaultAsyncHttpClientConfig.Builder clientBuilder = Dsl.config() .setConnectTimeout((int) CONNECTION_TIMEOUT.toMillis()) .setRequestTimeout((in...
}
public ManagementClientAsync(URI namespaceEndpointURI, ClientSettings clientSettings) { this.namespaceEndpointURI = namespaceEndpointURI; this.clientSettings = clientSettings; DefaultAsyncHttpClientConfig.Builder clientBuilder = Dsl.config() .setConnectTimeout((int) CONNECTION_TIMEOUT.toMillis()) .setUseProxySelector(t...
class ManagementClientAsync { private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(ManagementClientAsync.class); private static final int ONE_BOX_HTTPS_PORT = 4446; private static final String API_VERSION_QUERY = "api-version=2017-04"; private static final String USER_AGENT_HEADER_NAME = "User-Agent"; pri...
class ManagementClientAsync { private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(ManagementClientAsync.class); private static final int ONE_BOX_HTTPS_PORT = 4446; private static final String API_VERSION_QUERY = "api-version=2017-04"; private static final String USER_AGENT_HEADER_NAME = "User-Agent"; pri...
I saw this ref page using DefaultAzureCredential. https://github.com/Azure/azure-sdk-for-java/wiki/Identity-and-Authentication Should I follow it or use TokenCredential?
public void useAadAsyncClient() { DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() .endpoint("{endpoint}") .credential(defaultCredential) .buildAsyncClient(); }
DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().build();
public void useAadAsyncClient() { TokenCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() .endpoint("{endpoint}") .credential(defaultCredential) .buildAsyncClient(); }
class ReadmeSamples { private TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for configuring http client. */ public void configureHttpClient() { HttpClient client = new NettyAsyncHttpClientBuilder() .port(8080) .wiretap(true) .build(); } /** * Code snippet f...
class ReadmeSamples { private TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for configuring http client. */ public void configureHttpClient() { HttpClient client = new NettyAsyncHttpClientBuilder() .port(8080) .wiretap(true) .build(); } /** * Code snippet f...
It's better to use `TokenCredential` rather than a specific implementation. The builder says that `credential()` requires TokenCredential.
public void useAadAsyncClient() { DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() .endpoint("{endpoint}") .credential(defaultCredential) .buildAsyncClient(); }
DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().build();
public void useAadAsyncClient() { TokenCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() .endpoint("{endpoint}") .credential(defaultCredential) .buildAsyncClient(); }
class ReadmeSamples { private TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for configuring http client. */ public void configureHttpClient() { HttpClient client = new NettyAsyncHttpClientBuilder() .port(8080) .wiretap(true) .build(); } /** * Code snippet f...
class ReadmeSamples { private TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for configuring http client. */ public void configureHttpClient() { HttpClient client = new NettyAsyncHttpClientBuilder() .port(8080) .wiretap(true) .build(); } /** * Code snippet f...
this.tokenCredential = Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null.");
public FormRecognizerClientBuilder credential(TokenCredential tokenCredential) { Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); this.tokenCredential = tokenCredential; return this; }
this.tokenCredential = tokenCredential;
public FormRecognizerClientBuilder credential(TokenCredential tokenCredential) { this.tokenCredential = Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); return this; }
class FormRecognizerClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER_VALUE = ContentType.APPLICATION_JSON; private static final String ACCEPT_HEADER = "Accept"; private static final String FORM_RECOGNIZER_PROPERTIES = "...
class FormRecognizerClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER_VALUE = ContentType.APPLICATION_JSON; private static final String ACCEPT_HEADER = "Accept"; private static final String FORM_RECOGNIZER_PROPERTIES = "...
nit: `.build` can be on the same line.
public void useAadAsyncClient() { TokenCredential credential = new DefaultAzureCredentialBuilder() .build(); FormRecognizerClient formRecognizerClient = new FormRecognizerClientBuilder() .endpoint("{endpoint}") .credential(credential) .buildClient(); }
.build();
public void useAadAsyncClient() { TokenCredential credential = new DefaultAzureCredentialBuilder().build(); FormRecognizerClient formRecognizerClient = new FormRecognizerClientBuilder() .endpoint("{endpoint}") .credential(credential) .buildClient(); }
class ReadmeSamples { private FormRecognizerClient formRecognizerClient = new FormRecognizerClientBuilder().buildClient(); private FormTrainingClient formTrainingClient = formRecognizerClient.getFormTrainingClient(); /** * Code snippet for getting sync client using the AzureKeyCredential authentication. */ public void ...
class ReadmeSamples { private FormRecognizerClient formRecognizerClient = new FormRecognizerClientBuilder().buildClient(); private FormTrainingClient formTrainingClient = new FormTrainingClientBuilder().buildClient(); /** * Code snippet for getting sync client using the AzureKeyCredential authentication. */ public void...
nit: missing an empty space
public int[] getRequiredTokens() { return new int[]{ TokenTypes.CLASS_DEF, TokenTypes.CTOR_DEF, TokenTypes.LITERAL_THROW, TokenTypes.METHOD_DEF }; }
return new int[]{
public int[] getRequiredTokens() { return new int[] { TokenTypes.CLASS_DEF, TokenTypes.CTOR_DEF, TokenTypes.LITERAL_THROW, TokenTypes.METHOD_DEF }; }
class is static private final Queue<Boolean> classStaticDeque = Collections.asLifoQueue(new ArrayDeque<>()); private final Queue<Boolean> methodStaticDeque = Collections.asLifoQueue(new ArrayDeque<>()); private boolean isInConstructor = false; @Override public int[] getDefaultTokens() { return getRequiredTokens(); }
class is static private final Queue<Boolean> classStaticDeque = Collections.asLifoQueue(new ArrayDeque<>()); private final Queue<Boolean> methodStaticDeque = Collections.asLifoQueue(new ArrayDeque<>()); private boolean isInConstructor = false; @Override public int[] getDefaultTokens() { return getRequiredTokens(); }
Done
public int[] getRequiredTokens() { return new int[]{ TokenTypes.CLASS_DEF, TokenTypes.CTOR_DEF, TokenTypes.LITERAL_THROW, TokenTypes.METHOD_DEF }; }
return new int[]{
public int[] getRequiredTokens() { return new int[] { TokenTypes.CLASS_DEF, TokenTypes.CTOR_DEF, TokenTypes.LITERAL_THROW, TokenTypes.METHOD_DEF }; }
class is static private final Queue<Boolean> classStaticDeque = Collections.asLifoQueue(new ArrayDeque<>()); private final Queue<Boolean> methodStaticDeque = Collections.asLifoQueue(new ArrayDeque<>()); private boolean isInConstructor = false; @Override public int[] getDefaultTokens() { return getRequiredTokens(); }
class is static private final Queue<Boolean> classStaticDeque = Collections.asLifoQueue(new ArrayDeque<>()); private final Queue<Boolean> methodStaticDeque = Collections.asLifoQueue(new ArrayDeque<>()); private boolean isInConstructor = false; @Override public int[] getDefaultTokens() { return getRequiredTokens(); }
In track 2, we've named this as endpoint instead of `host`.
public StorageManagementClient buildClient() { if (host == null) { this.host = "https: } if (apiVersion == null) { this.apiVersion = "2019-06-01"; } if (environment == null) { this.environment = AzureEnvironment.AZURE; } if (pipeline == null) { this.pipeline = new HttpPipelineBuilder() .policies(new UserAgentPolicy(), ...
this.host = "https:
public StorageManagementClient buildClient() { if (endpoint == null) { this.endpoint = "https: } if (environment == null) { this.environment = AzureEnvironment.AZURE; } if (pipeline == null) { this.pipeline = new HttpPipelineBuilder() .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) .build(); } S...
class StorageManagementClientBuilder { /* * The ID of the target subscription. */ private String subscriptionId; /** * Sets The ID of the target subscription. * * @param subscriptionId the subscriptionId value. * @return the StorageManagementClientBuilder. */ public StorageManagementClientBuilder subscriptionId(String ...
class StorageManagementClientBuilder { /* * The ID of the target subscription. */ private String subscriptionId; /** * Sets The ID of the target subscription. * * @param subscriptionId the subscriptionId value. * @return the StorageManagementClientBuilder. */ public StorageManagementClientBuilder subscriptionId(String ...
Do you still need the null check for `apiVersion` now that the setter is removed?
public StorageManagementClient buildClient() { if (host == null) { this.host = "https: } if (apiVersion == null) { this.apiVersion = "2019-06-01"; } if (environment == null) { this.environment = AzureEnvironment.AZURE; } if (pipeline == null) { this.pipeline = new HttpPipelineBuilder() .policies(new UserAgentPolicy(), ...
}
public StorageManagementClient buildClient() { if (endpoint == null) { this.endpoint = "https: } if (environment == null) { this.environment = AzureEnvironment.AZURE; } if (pipeline == null) { this.pipeline = new HttpPipelineBuilder() .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) .build(); } S...
class StorageManagementClientBuilder { /* * The ID of the target subscription. */ private String subscriptionId; /** * Sets The ID of the target subscription. * * @param subscriptionId the subscriptionId value. * @return the StorageManagementClientBuilder. */ public StorageManagementClientBuilder subscriptionId(String ...
class StorageManagementClientBuilder { /* * The ID of the target subscription. */ private String subscriptionId; /** * Sets The ID of the target subscription. * * @param subscriptionId the subscriptionId value. * @return the StorageManagementClientBuilder. */ public StorageManagementClientBuilder subscriptionId(String ...
I guess it is in swagger as well https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/blob.json#L8 I will see if I can rename it in generator for mgmt.
public StorageManagementClient buildClient() { if (host == null) { this.host = "https: } if (apiVersion == null) { this.apiVersion = "2019-06-01"; } if (environment == null) { this.environment = AzureEnvironment.AZURE; } if (pipeline == null) { this.pipeline = new HttpPipelineBuilder() .policies(new UserAgentPolicy(), ...
this.host = "https:
public StorageManagementClient buildClient() { if (endpoint == null) { this.endpoint = "https: } if (environment == null) { this.environment = AzureEnvironment.AZURE; } if (pipeline == null) { this.pipeline = new HttpPipelineBuilder() .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) .build(); } S...
class StorageManagementClientBuilder { /* * The ID of the target subscription. */ private String subscriptionId; /** * Sets The ID of the target subscription. * * @param subscriptionId the subscriptionId value. * @return the StorageManagementClientBuilder. */ public StorageManagementClientBuilder subscriptionId(String ...
class StorageManagementClientBuilder { /* * The ID of the target subscription. */ private String subscriptionId; /** * Sets The ID of the target subscription. * * @param subscriptionId the subscriptionId value. * @return the StorageManagementClientBuilder. */ public StorageManagementClientBuilder subscriptionId(String ...
I will try to address it when tweaking generator.
public StorageManagementClient buildClient() { if (host == null) { this.host = "https: } if (apiVersion == null) { this.apiVersion = "2019-06-01"; } if (environment == null) { this.environment = AzureEnvironment.AZURE; } if (pipeline == null) { this.pipeline = new HttpPipelineBuilder() .policies(new UserAgentPolicy(), ...
}
public StorageManagementClient buildClient() { if (endpoint == null) { this.endpoint = "https: } if (environment == null) { this.environment = AzureEnvironment.AZURE; } if (pipeline == null) { this.pipeline = new HttpPipelineBuilder() .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) .build(); } S...
class StorageManagementClientBuilder { /* * The ID of the target subscription. */ private String subscriptionId; /** * Sets The ID of the target subscription. * * @param subscriptionId the subscriptionId value. * @return the StorageManagementClientBuilder. */ public StorageManagementClientBuilder subscriptionId(String ...
class StorageManagementClientBuilder { /* * The ID of the target subscription. */ private String subscriptionId; /** * Sets The ID of the target subscription. * * @param subscriptionId the subscriptionId value. * @return the StorageManagementClientBuilder. */ public StorageManagementClientBuilder subscriptionId(String ...
why?
public void queryDistinctDocuments() { List<String> queries = Arrays.asList( "SELECT %s VALUE null", "SELECT %s VALUE false", "SELECT %s VALUE true", "SELECT %s VALUE 1", "SELECT %s VALUE 'a'", "SELECT %s VALUE [null, true, false, 1, 'a']", "SELECT %s false AS p", "SELECT %s 1 AS p", "SELECT %s 'a' AS p", "SELECT %s VA...
public void queryDistinctDocuments() { List<String> queries = Arrays.asList( "SELECT %s VALUE null", "SELECT %s VALUE false", "SELECT %s VALUE true", "SELECT %s VALUE 1", "SELECT %s VALUE 'a'", "SELECT %s VALUE [null, true, false, 1, 'a']", "SELECT %s false AS p", "SELECT %s 1 AS p", "SELECT %s 'a' AS p", "SELECT %s VA...
class DistinctQueryTests extends TestSuiteBase { private final int TIMEOUT_120 = 120000; private final String FIELD = "name"; private CosmosAsyncContainer createdCollection; private ArrayList<CosmosItemProperties> docs = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuildersWithDir...
class DistinctQueryTests extends TestSuiteBase { private final int TIMEOUT_120 = 120000; private final String FIELD = "name"; private CosmosAsyncContainer createdCollection; private ArrayList<CosmosItemProperties> docs = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuildersWithDir...
since you're changing the name of layoutPageResults -> contentPageResults, I think it's a good idea to change recognizeLayoutPoller -> recognizeContentPoller
public static void main(final String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); File sourceFile = new File("../formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/" + "forms/...
List<FormPage> contentPageResults = recognizeLayoutPoller.getFinalResult();
public static void main(final String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); File sourceFile = new File("../formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/" + "forms/...
class RecognizeContent { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. * * @throws IOException Exception thrown when there is an error in reading all the bytes from the File. */ }
class RecognizeContent { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. * * @throws IOException Exception thrown when there is an error in reading all the bytes from the File. */ }
I actually added the reason a bit above than this assert as to why I have to lower the checks. // Weakening validation in this PR as distinctMap has to be changed to accept types not extending from Resource. This will be enabled in a different PR which is already actively in wip. I will discuss in more detail offlin...
public void queryDistinctDocuments() { List<String> queries = Arrays.asList( "SELECT %s VALUE null", "SELECT %s VALUE false", "SELECT %s VALUE true", "SELECT %s VALUE 1", "SELECT %s VALUE 'a'", "SELECT %s VALUE [null, true, false, 1, 'a']", "SELECT %s false AS p", "SELECT %s 1 AS p", "SELECT %s 'a' AS p", "SELECT %s VA...
public void queryDistinctDocuments() { List<String> queries = Arrays.asList( "SELECT %s VALUE null", "SELECT %s VALUE false", "SELECT %s VALUE true", "SELECT %s VALUE 1", "SELECT %s VALUE 'a'", "SELECT %s VALUE [null, true, false, 1, 'a']", "SELECT %s false AS p", "SELECT %s 1 AS p", "SELECT %s 'a' AS p", "SELECT %s VA...
class DistinctQueryTests extends TestSuiteBase { private final int TIMEOUT_120 = 120000; private final String FIELD = "name"; private CosmosAsyncContainer createdCollection; private ArrayList<CosmosItemProperties> docs = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuildersWithDir...
class DistinctQueryTests extends TestSuiteBase { private final int TIMEOUT_120 = 120000; private final String FIELD = "name"; private CosmosAsyncContainer createdCollection; private ArrayList<CosmosItemProperties> docs = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuildersWithDir...
Redundant null check that catched in the code quality process. [ERROR] Redundant nullcheck of documentSentimentLabel, which is known to be non-null in com.azure.ai.textanalytics.AnalyzeSentimentAsyncClient.convertToAnalyzeSentimentResult(DocumentSentiment) [com.azure.ai.textanalytics.AnalyzeSentimentAsyncClient] Redun...
private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment documentSentiment) { final SentimentConfidenceScorePerLabel confidenceScorePerLabel = documentSentiment.getConfidenceScores(); final List<SentenceSentiment> sentenceSentiments = documentSentiment.getSentences().stream() .map(sentenceSentim...
sentenceSentiment.getSentiment().toString(),
private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment documentSentiment) { final SentimentConfidenceScorePerLabel confidenceScorePerLabel = documentSentiment.getConfidenceScores(); final List<SentenceSentiment> sentenceSentiments = documentSentiment.getSentences().stream() .map(sentenceSentim...
class AnalyzeSentimentAsyncClient { private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link AnalyzeSentimentAsyncClient} that sends requests to the Text Analytics services's sentiment * analysis endpoint. * * @param s...
class AnalyzeSentimentAsyncClient { private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link AnalyzeSentimentAsyncClient} that sends requests to the Text Analytics services's sentiment * analysis endpoint. * * @param s...
This started coming up from the current change?
private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment documentSentiment) { final SentimentConfidenceScorePerLabel confidenceScorePerLabel = documentSentiment.getConfidenceScores(); final List<SentenceSentiment> sentenceSentiments = documentSentiment.getSentences().stream() .map(sentenceSentim...
sentenceSentiment.getSentiment().toString(),
private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment documentSentiment) { final SentimentConfidenceScorePerLabel confidenceScorePerLabel = documentSentiment.getConfidenceScores(); final List<SentenceSentiment> sentenceSentiments = documentSentiment.getSentences().stream() .map(sentenceSentim...
class AnalyzeSentimentAsyncClient { private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link AnalyzeSentimentAsyncClient} that sends requests to the Text Analytics services's sentiment * analysis endpoint. * * @param s...
class AnalyzeSentimentAsyncClient { private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link AnalyzeSentimentAsyncClient} that sends requests to the Text Analytics services's sentiment * analysis endpoint. * * @param s...
Yes. Null checking here is an redundant check. As the error message explained here.
private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment documentSentiment) { final SentimentConfidenceScorePerLabel confidenceScorePerLabel = documentSentiment.getConfidenceScores(); final List<SentenceSentiment> sentenceSentiments = documentSentiment.getSentences().stream() .map(sentenceSentim...
sentenceSentiment.getSentiment().toString(),
private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment documentSentiment) { final SentimentConfidenceScorePerLabel confidenceScorePerLabel = documentSentiment.getConfidenceScores(); final List<SentenceSentiment> sentenceSentiments = documentSentiment.getSentences().stream() .map(sentenceSentim...
class AnalyzeSentimentAsyncClient { private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link AnalyzeSentimentAsyncClient} that sends requests to the Text Analytics services's sentiment * analysis endpoint. * * @param s...
class AnalyzeSentimentAsyncClient { private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link AnalyzeSentimentAsyncClient} that sends requests to the Text Analytics services's sentiment * analysis endpoint. * * @param s...
@srnagar Is this the same thing that management SDK's are doing too? And you had some opinions to have a new model type for the exception rather than doing it this way?
public static Throwable mapToHttpResponseExceptionIfExist(Throwable throwable) { if (throwable instanceof TextAnalyticsErrorException) { TextAnalyticsErrorException errorException = (TextAnalyticsErrorException) throwable; return new HttpResponseException(errorException.getMessage(), errorException.getResponse(), toTex...
toTextAnalyticsError(errorException.getValue()));
public static Throwable mapToHttpResponseExceptionIfExist(Throwable throwable) { if (throwable instanceof TextAnalyticsErrorException) { TextAnalyticsErrorException errorException = (TextAnalyticsErrorException) throwable; return new HttpResponseException(errorException.getMessage(), errorException.getResponse(), toTex...
class Utility { private Utility() { } /** * Verify that list of documents are not null or empty. Otherwise, throw exception. * * @param documents A list of documents. * * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ public static...
class Utility { private Utility() { } /** * Verify that list of documents are not null or empty. Otherwise, throw exception. * * @param documents A list of documents. * * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ public static...
as discussion in the TA meeting, this change looks good.
public static Throwable mapToHttpResponseExceptionIfExist(Throwable throwable) { if (throwable instanceof TextAnalyticsErrorException) { TextAnalyticsErrorException errorException = (TextAnalyticsErrorException) throwable; return new HttpResponseException(errorException.getMessage(), errorException.getResponse(), toTex...
toTextAnalyticsError(errorException.getValue()));
public static Throwable mapToHttpResponseExceptionIfExist(Throwable throwable) { if (throwable instanceof TextAnalyticsErrorException) { TextAnalyticsErrorException errorException = (TextAnalyticsErrorException) throwable; return new HttpResponseException(errorException.getMessage(), errorException.getResponse(), toTex...
class Utility { private Utility() { } /** * Verify that list of documents are not null or empty. Otherwise, throw exception. * * @param documents A list of documents. * * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ public static...
class Utility { private Utility() { } /** * Verify that list of documents are not null or empty. Otherwise, throw exception. * * @param documents A list of documents. * * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ public static...
In `toTextAnalyticsError` .NET is using the top-level error to form the exception, but here we are using the innerError value if present.
public static Throwable mapToHttpResponseExceptionIfExist(Throwable throwable) { if (throwable instanceof TextAnalyticsErrorException) { TextAnalyticsErrorException errorException = (TextAnalyticsErrorException) throwable; return new HttpResponseException(errorException.getMessage(), errorException.getResponse(), toTex...
toTextAnalyticsError(errorException.getValue()));
public static Throwable mapToHttpResponseExceptionIfExist(Throwable throwable) { if (throwable instanceof TextAnalyticsErrorException) { TextAnalyticsErrorException errorException = (TextAnalyticsErrorException) throwable; return new HttpResponseException(errorException.getMessage(), errorException.getResponse(), toTex...
class Utility { private Utility() { } /** * Verify that list of documents are not null or empty. Otherwise, throw exception. * * @param documents A list of documents. * * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ public static...
class Utility { private Utility() { } /** * Verify that list of documents are not null or empty. Otherwise, throw exception. * * @param documents A list of documents. * * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ public static...
This is what python used to use innerError https://github.com/Azure/azure-sdk-for-python/pull/11155/files#diff-6814e3aaeba6362738bfde592d65bd9bR64
public static Throwable mapToHttpResponseExceptionIfExist(Throwable throwable) { if (throwable instanceof TextAnalyticsErrorException) { TextAnalyticsErrorException errorException = (TextAnalyticsErrorException) throwable; return new HttpResponseException(errorException.getMessage(), errorException.getResponse(), toTex...
toTextAnalyticsError(errorException.getValue()));
public static Throwable mapToHttpResponseExceptionIfExist(Throwable throwable) { if (throwable instanceof TextAnalyticsErrorException) { TextAnalyticsErrorException errorException = (TextAnalyticsErrorException) throwable; return new HttpResponseException(errorException.getMessage(), errorException.getResponse(), toTex...
class Utility { private Utility() { } /** * Verify that list of documents are not null or empty. Otherwise, throw exception. * * @param documents A list of documents. * * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ public static...
class Utility { private Utility() { } /** * Verify that list of documents are not null or empty. Otherwise, throw exception. * * @param documents A list of documents. * * @throws NullPointerException if {@code documents} is {@code null}. * @throws IllegalArgumentException if {@code documents} is empty. */ public static...
can this be updated to use the public apis for setting precision.
DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList<String> paths = new ArrayList<>(); paths.add("/mypk"); partitionKeyDef.setPaths(paths); IndexingPolicy indexingPolicy = new IndexingPolicy(); List<IncludedPath> includedPath...
BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "precision", -1);
DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList<String> paths = new ArrayList<>(); paths.add("/mypk"); partitionKeyDef.setPaths(paths); IndexingPolicy indexingPolicy = new IndexingPolicy(); List<IncludedPath> includedPath...
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...