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
This has been resolved from offline discussion and will continue with this approach in the short term until the long term approach to support such transformations in autorest itself is available.
public static CharFilter map(com.azure.search.documents.implementation.models.CharFilter obj) { if (obj instanceof PatternReplaceCharFilter) { return PatternReplaceCharFilterConverter.map((PatternReplaceCharFilter) obj); } if (obj instanceof MappingCharFilter) { return MappingCharFilterConverter.map((MappingCharFilter)...
if (obj instanceof PatternReplaceCharFilter) {
public static CharFilter map(com.azure.search.documents.implementation.models.CharFilter obj) { if (obj instanceof PatternReplaceCharFilter) { return PatternReplaceCharFilterConverter.map((PatternReplaceCharFilter) obj); } if (obj instanceof MappingCharFilter) { return MappingCharFilterConverter.map((MappingCharFilter)...
class converter. */
class converter. */
Is this something new we are introducing in this PR? Rather if `keyPhraseResultCollection` is empty return the same to client-side? What do other languages do here?
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
new TextAnalyticsException("None key Phrases extracted.",
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
Yes. I will update it to return empty.
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
new TextAnalyticsException("None key Phrases extracted.",
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
Is this required?
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
return new KeyPhrasesCollection(null, null);
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
Can `keyPhraseResultCollection.getValue()` be null or empty?
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
for (ExtractKeyPhraseResult keyPhraseResult : keyPhraseResultCollection.getValue()) {
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
Why do we have this in all the response mappers? Also, the comment is confusing. Either it gets executed or not. If it is expected to not be executed, then we should throw an exception when it does.
public Mono<DetectedLanguage> detectLanguage(String document, String countryHint) { try { Objects.requireNonNull(document, "'document' cannot be null."); return detectLanguageBatch(Collections.singletonList(document), countryHint, null) .map(detectLanguageResultCollection -> { for (DetectLanguageResult detectLanguageR...
return new DetectedLanguage(null, null, -1, null);
public Mono<DetectedLanguage> detectLanguage(String document, String countryHint) { try { Objects.requireNonNull(document, "'document' cannot be null."); return detectLanguageBatch(Collections.singletonList(document), countryHint, null) .map(detectLanguageResultCollection -> { DetectedLanguage detectedLanguage = null;...
class TextAnalyticsAsyncClient { private final ClientLogger logger = new ClientLogger(TextAnalyticsAsyncClient.class); private final TextAnalyticsClientImpl service; private final TextAnalyticsServiceVersion serviceVersion; private final String defaultCountryHint; private final String defaultLanguage; static final Stri...
class TextAnalyticsAsyncClient { private final ClientLogger logger = new ClientLogger(TextAnalyticsAsyncClient.class); private final TextAnalyticsClientImpl service; private final TextAnalyticsServiceVersion serviceVersion; private final String defaultCountryHint; private final String defaultLanguage; static final Stri...
will remove it
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("184654c847d54432b8301a4b76f63045")) .endpoint("https: .buildClient(); List<TextDocumentInput> documents = Arrays.asList( new TextDocumentInput("A", "Satya Nadella is the CEO of Micr...
.credential(new AzureKeyCredential("184654c847d54432b8301a4b76f63045"))
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); List<TextDocumentInput> documents = Arrays.asList( new TextDocumentInput("A", "Satya Nadella is the CEO of Microsoft.").setLanguage(...
class RecognizeEntitiesBatchDocuments { /** * Main method to invoke this demo about how to recognize the entities of {@link TextDocumentInput} documents. * * @param args Unused arguments to the program. */ }
class RecognizeEntitiesBatchDocuments { /** * Main method to invoke this demo about how to recognize the entities of {@link TextDocumentInput} documents. * * @param args Unused arguments to the program. */ }
is the endpoint printed somewhere? do we need to rotate this key?
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("184654c847d54432b8301a4b76f63045")) .endpoint("https: .buildClient(); List<TextDocumentInput> documents = Arrays.asList( new TextDocumentInput("A", "Satya Nadella is the CEO of Micr...
.credential(new AzureKeyCredential("184654c847d54432b8301a4b76f63045"))
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); List<TextDocumentInput> documents = Arrays.asList( new TextDocumentInput("A", "Satya Nadella is the CEO of Microsoft.").setLanguage(...
class RecognizeEntitiesBatchDocuments { /** * Main method to invoke this demo about how to recognize the entities of {@link TextDocumentInput} documents. * * @param args Unused arguments to the program. */ }
class RecognizeEntitiesBatchDocuments { /** * Main method to invoke this demo about how to recognize the entities of {@link TextDocumentInput} documents. * * @param args Unused arguments to the program. */ }
you have to return or throw something. so i just return it. Is there a better way to refactor the code?
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
return new KeyPhrasesCollection(null, null);
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
the valuable keyPhraseResultCollection, should change to response, so it will be response.getValue() As I know, response.getValue() should not be empty or null?
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
for (ExtractKeyPhraseResult keyPhraseResult : keyPhraseResultCollection.getValue()) {
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
refactored the code. How is looks now?
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
return new KeyPhrasesCollection(null, null);
Mono<KeyPhrasesCollection> extractKeyPhrasesSingleText(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document); textDocumentInput.setLanguage(language); return extractKeyPhrasesWithResponse...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
class ExtractKeyPhraseAsyncClient { private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract * keyphrase endpoint. * * @param se...
Throw an exception will make java inconsistency with other languages.
public Mono<DetectedLanguage> detectLanguage(String document, String countryHint) { try { Objects.requireNonNull(document, "'document' cannot be null."); return detectLanguageBatch(Collections.singletonList(document), countryHint, null) .map(detectLanguageResultCollection -> { for (DetectLanguageResult detectLanguageR...
return new DetectedLanguage(null, null, -1, null);
public Mono<DetectedLanguage> detectLanguage(String document, String countryHint) { try { Objects.requireNonNull(document, "'document' cannot be null."); return detectLanguageBatch(Collections.singletonList(document), countryHint, null) .map(detectLanguageResultCollection -> { DetectedLanguage detectedLanguage = null;...
class TextAnalyticsAsyncClient { private final ClientLogger logger = new ClientLogger(TextAnalyticsAsyncClient.class); private final TextAnalyticsClientImpl service; private final TextAnalyticsServiceVersion serviceVersion; private final String defaultCountryHint; private final String defaultLanguage; static final Stri...
class TextAnalyticsAsyncClient { private final ClientLogger logger = new ClientLogger(TextAnalyticsAsyncClient.class); private final TextAnalyticsClientImpl service; private final TextAnalyticsServiceVersion serviceVersion; private final String defaultCountryHint; private final String defaultLanguage; static final Stri...
could you expand on what the scenario is here? not sure why we need to create this fake object. How will the user consume/use this?
public Mono<DetectedLanguage> detectLanguage(String document, String countryHint) { try { Objects.requireNonNull(document, "'document' cannot be null."); return detectLanguageBatch(Collections.singletonList(document), countryHint, null) .map(detectLanguageResultCollection -> { for (DetectLanguageResult detectLanguageR...
return new DetectedLanguage(null, null, -1, null);
public Mono<DetectedLanguage> detectLanguage(String document, String countryHint) { try { Objects.requireNonNull(document, "'document' cannot be null."); return detectLanguageBatch(Collections.singletonList(document), countryHint, null) .map(detectLanguageResultCollection -> { DetectedLanguage detectedLanguage = null;...
class TextAnalyticsAsyncClient { private final ClientLogger logger = new ClientLogger(TextAnalyticsAsyncClient.class); private final TextAnalyticsClientImpl service; private final TextAnalyticsServiceVersion serviceVersion; private final String defaultCountryHint; private final String defaultLanguage; static final Stri...
class TextAnalyticsAsyncClient { private final ClientLogger logger = new ClientLogger(TextAnalyticsAsyncClient.class); private final TextAnalyticsClientImpl service; private final TextAnalyticsServiceVersion serviceVersion; private final String defaultCountryHint; private final String defaultLanguage; static final Stri...
@maririos It is what we discussed afternoon. .NET return it as it is. The scenario is when user gives a single input document, internally, it called the batch API. And then we get the batch output result collection, which in here, `DetectLanguageResultCollection`, this class extends `IterableStream<DetectLanguageRes...
public Mono<DetectedLanguage> detectLanguage(String document, String countryHint) { try { Objects.requireNonNull(document, "'document' cannot be null."); return detectLanguageBatch(Collections.singletonList(document), countryHint, null) .map(detectLanguageResultCollection -> { for (DetectLanguageResult detectLanguageR...
return new DetectedLanguage(null, null, -1, null);
public Mono<DetectedLanguage> detectLanguage(String document, String countryHint) { try { Objects.requireNonNull(document, "'document' cannot be null."); return detectLanguageBatch(Collections.singletonList(document), countryHint, null) .map(detectLanguageResultCollection -> { DetectedLanguage detectedLanguage = null;...
class TextAnalyticsAsyncClient { private final ClientLogger logger = new ClientLogger(TextAnalyticsAsyncClient.class); private final TextAnalyticsClientImpl service; private final TextAnalyticsServiceVersion serviceVersion; private final String defaultCountryHint; private final String defaultLanguage; static final Stri...
class TextAnalyticsAsyncClient { private final ClientLogger logger = new ClientLogger(TextAnalyticsAsyncClient.class); private final TextAnalyticsClientImpl service; private final TextAnalyticsServiceVersion serviceVersion; private final String defaultCountryHint; private final String defaultLanguage; static final Stri...
@mssfang can be handled similarly https://github.com/Azure/azure-sdk-for-java/pull/11318/files#diff-8d0c97bfcab02df81ac3a72abd26a2a2R78-R89 Update the comment indicating that an empty result is returned when the service returns an empty collection.
public Mono<DetectedLanguage> detectLanguage(String document, String countryHint) { try { Objects.requireNonNull(document, "'document' cannot be null."); return detectLanguageBatch(Collections.singletonList(document), countryHint, null) .map(detectLanguageResultCollection -> { for (DetectLanguageResult detectLanguageR...
return new DetectedLanguage(null, null, -1, null);
public Mono<DetectedLanguage> detectLanguage(String document, String countryHint) { try { Objects.requireNonNull(document, "'document' cannot be null."); return detectLanguageBatch(Collections.singletonList(document), countryHint, null) .map(detectLanguageResultCollection -> { DetectedLanguage detectedLanguage = null;...
class TextAnalyticsAsyncClient { private final ClientLogger logger = new ClientLogger(TextAnalyticsAsyncClient.class); private final TextAnalyticsClientImpl service; private final TextAnalyticsServiceVersion serviceVersion; private final String defaultCountryHint; private final String defaultLanguage; static final Stri...
class TextAnalyticsAsyncClient { private final ClientLogger logger = new ClientLogger(TextAnalyticsAsyncClient.class); private final TextAnalyticsClientImpl service; private final TextAnalyticsServiceVersion serviceVersion; private final String defaultCountryHint; private final String defaultLanguage; static final Stri...
Is there a case where `authenticateWithConfidentialClientCache` would return `null`? If not I believe these could be merged into the `onErrorResume`.
public Mono<AccessToken> getToken(TokenRequestContext request) { return identityClient.authenticateWithConfidentialClientCache(request) .onErrorResume(t -> Mono.empty()) .switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithConfidentialClient(request))); }
.switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithConfidentialClient(request)));
public Mono<AccessToken> getToken(TokenRequestContext request) { return identityClient.authenticateWithConfidentialClientCache(request) .onErrorResume(t -> Mono.empty()) .switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithConfidentialClient(request))); }
class ClientCertificateCredential implements TokenCredential { private final IdentityClient identityClient; /** * Creates a ClientSecretCredential with default identity client options. * @param tenantId the tenant ID of the application * @param clientId the client ID of the application * @param certificatePath the PEM ...
class ClientCertificateCredential implements TokenCredential { private final IdentityClient identityClient; /** * Creates a ClientSecretCredential with default identity client options. * @param tenantId the tenant ID of the application * @param clientId the client ID of the application * @param certificatePath the PEM ...
I don't know if we need the `Mono.defer` here, I believe `switchIfEmpty` only processes if the upstream returns empty otherwise it is never ran.
public Mono<AccessToken> getToken(TokenRequestContext request) { return identityClient.authenticateWithConfidentialClientCache(request) .onErrorResume(t -> Mono.empty()) .switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithConfidentialClient(request))); }
.switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithConfidentialClient(request)));
public Mono<AccessToken> getToken(TokenRequestContext request) { return identityClient.authenticateWithConfidentialClientCache(request) .onErrorResume(t -> Mono.empty()) .switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithConfidentialClient(request))); }
class ClientCertificateCredential implements TokenCredential { private final IdentityClient identityClient; /** * Creates a ClientSecretCredential with default identity client options. * @param tenantId the tenant ID of the application * @param clientId the client ID of the application * @param certificatePath the PEM ...
class ClientCertificateCredential implements TokenCredential { private final IdentityClient identityClient; /** * Creates a ClientSecretCredential with default identity client options. * @param tenantId the tenant ID of the application * @param clientId the client ID of the application * @param certificatePath the PEM ...
Not needed, but given this has a lot of nesting and all other conditionals hit terminal states above could the `else` be removed for a regular code block?
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
} else {
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
Thoughts on merging all these to use their super class `GeneralSecurityException`.
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
| NoSuchProviderException
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
Would this be better off above attempting to retrieve the credential as this will fail without requiring IO or handling security? Basically, this is a lighter exception to have happen first.
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
}
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
Does `Mono.fromFuture` wrap the thrown exception into a `Mono.error` or will this need to be handled as a regular exception?
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
throw logger.logExceptionAsError(Exceptions.propagate(e));
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
It could complete without calling `onNext()` so we cannot merge them.
public Mono<AccessToken> getToken(TokenRequestContext request) { return identityClient.authenticateWithConfidentialClientCache(request) .onErrorResume(t -> Mono.empty()) .switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithConfidentialClient(request))); }
.switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithConfidentialClient(request)));
public Mono<AccessToken> getToken(TokenRequestContext request) { return identityClient.authenticateWithConfidentialClientCache(request) .onErrorResume(t -> Mono.empty()) .switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithConfidentialClient(request))); }
class ClientCertificateCredential implements TokenCredential { private final IdentityClient identityClient; /** * Creates a ClientSecretCredential with default identity client options. * @param tenantId the tenant ID of the application * @param clientId the client ID of the application * @param certificatePath the PEM ...
class ClientCertificateCredential implements TokenCredential { private final IdentityClient identityClient; /** * Creates a ClientSecretCredential with default identity client options. * @param tenantId the tenant ID of the application * @param clientId the client ID of the application * @param certificatePath the PEM ...
switchIfEmpty only processes the Mono if the upstream returns empty, but the method call `identityClient.authenticateWithConfidentialClient()` would be executed before the stream starts.
public Mono<AccessToken> getToken(TokenRequestContext request) { return identityClient.authenticateWithConfidentialClientCache(request) .onErrorResume(t -> Mono.empty()) .switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithConfidentialClient(request))); }
.switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithConfidentialClient(request)));
public Mono<AccessToken> getToken(TokenRequestContext request) { return identityClient.authenticateWithConfidentialClientCache(request) .onErrorResume(t -> Mono.empty()) .switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithConfidentialClient(request))); }
class ClientCertificateCredential implements TokenCredential { private final IdentityClient identityClient; /** * Creates a ClientSecretCredential with default identity client options. * @param tenantId the tenant ID of the application * @param clientId the client ID of the application * @param certificatePath the PEM ...
class ClientCertificateCredential implements TokenCredential { private final IdentityClient identityClient; /** * Creates a ClientSecretCredential with default identity client options. * @param tenantId the tenant ID of the application * @param clientId the client ID of the application * @param certificatePath the PEM ...
removed.
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
} else {
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
works like a charm
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
| NoSuchProviderException
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
I'm not sure how reactor handles it. Since it's not documented even if there's anything, I'm returning CompletableFuture.failedFuture() instead.
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
throw logger.logExceptionAsError(Exceptions.propagate(e));
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
Unfortunately the ConfidentialClientApplication.Builder requires the credential to be passed in the constructor of the builder, not as a builder setter. So the authority has to be set after the credential.
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
}
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
the logic to build httpPipelineAdapter from line 177 - 193, can be extracted in a common helper method, and used in getPublicClient / getCofidentialClient methods.
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
httpPipelineAdapter = new HttpPipelineAdapter(httpPipeline);
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
Why are we doing Exceptions.propagate and not directly converting to Runtime Exception ?
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
return getFailedCompletableFuture(logger.logExceptionAsError(Exceptions.propagate(e)));
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
Do we expect MSAL to return an expired token ?
public Mono<AccessToken> authenticateWithConfidentialClientCache(TokenRequestContext request) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); try { return getConfidentialClientApplication().acquireTokenSilently(...
.filter(t -> !t.isExpired());
public Mono<AccessToken> authenticateWithConfidentialClientCache(TokenRequestContext request) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); try { return getConfidentialClientApplication().acquireTokenSilently(...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
That's not possible actually - the public client builder and the confidential client builder extends from a builder base that's not public. So from outside the MSAL library, the public client builder and confidential client builder are totally unrelated classes.
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
httpPipelineAdapter = new HttpPipelineAdapter(httpPipeline);
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
@alzimmermsft suggested this usage pattern to me.
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
return getFailedCompletableFuture(logger.logExceptionAsError(Exceptions.propagate(e)));
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
No. But a non-expired IAuthenticationResult could be an expired AccessToken because of the offset. In my token refresh offset re-work, this line will be changed to `.filter(t -> OffsetDateTime.now().isBefore(t.getExpiresAt().minus(identityClientOptions.getTokenRefreshOffset())));` But for now this may look a little con...
public Mono<AccessToken> authenticateWithConfidentialClientCache(TokenRequestContext request) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); try { return getConfidentialClientApplication().acquireTokenSilently(...
.filter(t -> !t.isExpired());
public Mono<AccessToken> authenticateWithConfidentialClientCache(TokenRequestContext request) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); try { return getConfidentialClientApplication().acquireTokenSilently(...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
Actually I know a reason - if `e` is already a subclass of `RuntimeException`, wrapping it in another `RuntimeException` is bad. `Exceptions.propagate(e)` will check if `e` is a RuntimeException first and only wrap if not.
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
return getFailedCompletableFuture(logger.logExceptionAsError(Exceptions.propagate(e)));
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
Okay, But we already know, MalformedURLException is not a RuntimeException here. So, that check is redundant.
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
return getFailedCompletableFuture(logger.logExceptionAsError(Exceptions.propagate(e)));
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
I am talking about this possible change/refactor which can be used in both getPublicClient and getConfidentialClient methods. `HttpPipelineAdapter httpPipelineAdapter = getHttpPipelineAdapter(); if (httpPipelineAdapter != null) { applicationBuilder.httpClient(httpPipelineAdapter); } else { applicationBuilder....
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
httpPipelineAdapter = new HttpPipelineAdapter(httpPipeline);
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
I think we skip checkstyles on samples.
public static void main(String[] args) { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); String modelId = "{model_Id}"; String formUrl = "{form_url}"; SyncPoller<OperationResult, List<RecognizedForm>> recognizeFormPoller = cl...
formWordElement.getBoundingBox().getPoints().forEach(point -> boundingBoxStr.append(String.format("[%.2f, %.2f]", point.getX(),
public static void main(String[] args) { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); String modelId = "{model_Id}"; String formUrl = "{form_url}"; SyncPoller<OperationResult, List<RecognizedForm>> recognizeFormPoller = cl...
class GetBoundingBoxes { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. */ }
class GetBoundingBoxes { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. */ }
Refactored.
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
httpPipelineAdapter = new HttpPipelineAdapter(httpPipeline);
private ConfidentialClientApplication getConfidentialClientApplication() { if (confidentialClientApplication != null) { return confidentialClientApplication; } else if (clientId == null) { throw logger.logExceptionAsError(new IllegalArgumentException( "A non-null value for client ID must be provided for user authentica...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
That's correct. But at this point it's really a personal preference thing. I changed it to `new RuntimeException()` for the if check it saves. But one could argue in the future if more exceptions are thrown or this code path is refactored to merge with other paths that could throw RuntimeExceptions this could potential...
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
return getFailedCompletableFuture(logger.logExceptionAsError(Exceptions.propagate(e)));
public Mono<MsalToken> authenticateWithPublicClientCache(TokenRequestContext request, IAccount account) { return Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilde...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
Should this throw an exception if `httpClient` is null and proxy options are set?
private void initializeHttpPipelineAdapter() { HttpPipeline httpPipeline = options.getHttpPipeline(); if (httpPipeline != null) { httpPipelineAdapter = new HttpPipelineAdapter(httpPipeline); } else { HttpClient httpClient = options.getHttpClient(); if (httpClient != null) { httpPipelineAdapter = new HttpPipelineAdapter...
httpPipelineAdapter = new HttpPipelineAdapter(setupPipeline(HttpClient.createDefault()));
private void initializeHttpPipelineAdapter() { HttpPipeline httpPipeline = options.getHttpPipeline(); if (httpPipeline != null) { httpPipelineAdapter = new HttpPipelineAdapter(httpPipeline); } else { HttpClient httpClient = options.getHttpClient(); if (httpClient != null) { httpPipelineAdapter = new HttpPipelineAdapter...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
No - it's a valid scenario which is handled in line 177: https://github.com/Azure/azure-sdk-for-java/pull/11355/files/1c100d5ba097af9d5ba670b34d010f25d5606681#diff-56093106beda983b28894478869221c6R177. Basically, the only time we don't want to initialize the httpPipelineAdapter is when a proxy option is provided - in w...
private void initializeHttpPipelineAdapter() { HttpPipeline httpPipeline = options.getHttpPipeline(); if (httpPipeline != null) { httpPipelineAdapter = new HttpPipelineAdapter(httpPipeline); } else { HttpClient httpClient = options.getHttpClient(); if (httpClient != null) { httpPipelineAdapter = new HttpPipelineAdapter...
httpPipelineAdapter = new HttpPipelineAdapter(setupPipeline(HttpClient.createDefault()));
private void initializeHttpPipelineAdapter() { HttpPipeline httpPipeline = options.getHttpPipeline(); if (httpPipeline != null) { httpPipelineAdapter = new HttpPipelineAdapter(httpPipeline); } else { HttpClient httpClient = options.getHttpClient(); if (httpClient != null) { httpPipelineAdapter = new HttpPipelineAdapter...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
why is this final and the rest are not
public static void main(final String[] args) { FormTrainingClient client = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); String targetResourceId = "target-resource-Id"; String targetResourceRegion = "target-resource-region"; final String copyModelId = "co...
final String copyModelId = "copy-model-Id";
public static void main(final String[] args) { FormTrainingClient sourceClient = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); FormTrainingClient targetClient = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https:...
class CopyModel { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
class CopyModel { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
Why are these final, but the above variables in the code snippet not
public void getCopyAuthorization() { final String resourceId = "target-resource-Id"; final String resourceRegion = "target-resource-region"; formTrainingAsyncClient.getCopyAuthorization(resourceId, resourceRegion) .subscribe(copyAuthorization -> System.out.printf("Copy Authorization for model id: %s, access token: %s, ...
final String resourceId = "target-resource-Id";
public void getCopyAuthorization() { String resourceId = "target-resource-Id"; String resourceRegion = "target-resource-region"; formTrainingAsyncClient.getCopyAuthorization(resourceId, resourceRegion) .subscribe(copyAuthorization -> System.out.printf("Copy Authorization for model id: %s, access token: %s, expiration t...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormTrainingClientBuilder().buildAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() { FormTrainingAsyncClient formTr...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormTrainingClientBuilder().buildAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() { FormTrainingAsyncClient formTr...
I will update this to not be final, it doesn't add a lot and will avoid too much of code in the user-samples.
public static void main(final String[] args) { FormTrainingClient client = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); String targetResourceId = "target-resource-Id"; String targetResourceRegion = "target-resource-region"; final String copyModelId = "co...
final String copyModelId = "copy-model-Id";
public static void main(final String[] args) { FormTrainingClient sourceClient = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); FormTrainingClient targetClient = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https:...
class CopyModel { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
class CopyModel { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
it will be good to clarify that this is the client that contains the model we want to copy
public static void main(final String[] args) { FormTrainingClient client = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); String targetResourceId = "target-resource-Id"; String targetResourceRegion = "target-resource-region"; final String copyModelId = "co...
public static void main(final String[] args) { FormTrainingClient sourceClient = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); FormTrainingClient targetClient = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https:...
class CopyModel { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
class CopyModel { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
good to add a comment saying this is the id of the model we want to copy
public static void main(final String[] args) { FormTrainingClient client = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); String targetResourceId = "target-resource-Id"; String targetResourceRegion = "target-resource-region"; final String copyModelId = "co...
final String copyModelId = "copy-model-Id";
public static void main(final String[] args) { FormTrainingClient sourceClient = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); FormTrainingClient targetClient = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https:...
class CopyModel { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
class CopyModel { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
This shouldn't work. modelId's should be different
void beginCopy(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormTrainingAsyncClient(httpClient, serviceVersion); beginTrainingUnlabeledRunner((trainingFilesUrl, useTrainingLabels) -> { SyncPoller<OperationResult, CustomFormModel> syncPoller = client.beginTraining(trainingFilesUrl, u...
assertEquals(actualModel.getModelId(), copyModel.getModelId());
void beginCopy(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) {
class FormTrainingAsyncClientTest extends FormTrainingClientTestBase { static final String EXPECTED_COPY_REQUEST_INVALID_TARGET_RESOURCE_REGION = "Status code 400, \"{\"error\":{\"code\":\"1002\",\"message\":\"Copy request is invalid. Field 'TargetResourceRegion' must be a valid Azure region name.\"}}\""; private FormT...
class FormTrainingAsyncClientTest extends FormTrainingClientTestBase { static final String EXPECTED_COPY_REQUEST_INVALID_TARGET_RESOURCE_REGION = "Status code 400, \"{\"error\":{\"code\":\"1002\",\"message\":\"Copy request is invalid. Field 'TargetResourceRegion' must be a valid Azure region name.\"}}\""; private FormT...
when this is enabled, this shouldn't work either
void beginCopy(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormTrainingAsyncClient(httpClient, serviceVersion); beginTrainingUnlabeledRunner((trainingFilesUrl, useTrainingLabels) -> { SyncPoller<OperationResult, CustomFormModel> syncPoller = client.beginTraining(trainingFilesUrl, u...
void beginCopy(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) {
class FormTrainingAsyncClientTest extends FormTrainingClientTestBase { static final String EXPECTED_COPY_REQUEST_INVALID_TARGET_RESOURCE_REGION = "Status code 400, \"{\"error\":{\"code\":\"1002\",\"message\":\"Copy request is invalid. Field 'TargetResourceRegion' must be a valid Azure region name.\"}}\""; private FormT...
class FormTrainingAsyncClientTest extends FormTrainingClientTestBase { static final String EXPECTED_COPY_REQUEST_INVALID_TARGET_RESOURCE_REGION = "Status code 400, \"{\"error\":{\"code\":\"1002\",\"message\":\"Copy request is invalid. Field 'TargetResourceRegion' must be a valid Azure region name.\"}}\""; private FormT...
```suggestion if (OperationStatus.FAILED.equals(copyResult.getStatus())) { ```
private void throwIfCopyOperationStatusInvalid(CopyOperationResult copyResult) { if (copyResult.getStatus().equals(OperationStatus.FAILED)) { List<ErrorInformation> errorInformationList = copyResult.getCopyResult().getErrors(); if (!CoreUtils.isNullOrEmpty(errorInformationList)) { throw logger.logExceptionAsError(new H...
if (copyResult.getStatus().equals(OperationStatus.FAILED)) {
private void throwIfCopyOperationStatusInvalid(CopyOperationResult copyResult) { if (copyResult.getStatus().equals(OperationStatus.FAILED)) { List<ErrorInformation> errorInformationList = copyResult.getCopyResult().getErrors(); if (!CoreUtils.isNullOrEmpty(errorInformationList)) { throw logger.logExceptionAsError(new H...
class FormTrainingAsyncClient { private final ClientLogger logger = new ClientLogger(FormTrainingAsyncClient.class); private final FormRecognizerClientImpl service; private final FormRecognizerServiceVersion serviceVersion; /** * Create a {@link FormTrainingClient} that sends requests to the Form Recognizer service's e...
class FormTrainingAsyncClient { private final ClientLogger logger = new ClientLogger(FormTrainingAsyncClient.class); private final FormRecognizerClientImpl service; private final FormRecognizerServiceVersion serviceVersion; /** * Create a {@link FormTrainingClient} that sends requests to the Form Recognizer service's e...
nit: we don't need `this` keyword here.
public String getModelId() { return this.modelId; }
return this.modelId;
public String getModelId() { return this.modelId; }
class CopyAuthorization { private static final SerializerAdapter SERIALIZER = new JacksonAdapter(); CopyAuthorization() { super(); } /* * Model identifier. */ private String modelId; /* * Token claim used to authorize the request. */ private String accessToken; /* * Resource Identifier. */ @JsonIgnore private String re...
class CopyAuthorization { private static final SerializerAdapter SERIALIZER = new JacksonAdapter(); CopyAuthorization() { super(); } /* * Model identifier. */ private String modelId; /* * Token claim used to authorize the request. */ private String accessToken; /* * Resource Identifier. */ private String resourceId; /*...
Wow, that was a bug? Is PKrangeID always guaranteed in this code path?
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId(); getLocalSession...
String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId();
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { getLocalSessionToken(request, sessionToken, StringUtils.EMPTY); request.getHeaders().remove(HttpConsta...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
this is for validation. Why this change is needed?
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId(); getLocalSession...
String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId();
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { getLocalSessionToken(request, sessionToken, StringUtils.EMPTY); request.getHeaders().remove(HttpConsta...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
Yes, this was a bug. It is guaranteed, if not present, then it is a bug.
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId(); getLocalSession...
String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId();
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { getLocalSessionToken(request, sessionToken, StringUtils.EMPTY); request.getHeaders().remove(HttpConsta...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
log and throw
public Mono<AuthenticationRecord> authenticate() { String defaultScope = KnownAuthorityHosts.getDefaultScope(authorityHost); if (defaultScope == null) { return Mono.error(new AuthenticationRequiredException("Authenticating in this environment requires" + " specifying a TokenRequestContext.")); } return authenticate(new...
}
public Mono<AuthenticationRecord> authenticate() { String defaultScope = KnownAuthorityHosts.getDefaultScope(authorityHost); if (defaultScope == null) { return Mono.error(logger.logExceptionAsError(new CredentialUnavailableException("Authenticating in this " + "environment requires specifying a TokenRequestContext.")))...
class DeviceCodeCredential implements TokenCredential { private final Consumer<DeviceCodeInfo> challengeConsumer; private final IdentityClient identityClient; private final AtomicReference<MsalAuthenticationAccount> cachedToken; private final String authorityHost; private final boolean automaticAuthentication; /** * Cr...
class DeviceCodeCredential implements TokenCredential { private final Consumer<DeviceCodeInfo> challengeConsumer; private final IdentityClient identityClient; private final AtomicReference<MsalAuthenticationAccount> cachedToken; private final String authorityHost; private final boolean automaticAuthentication; private ...
please add a unit test for the change. See `PartitionKeyInternalTest` for existing tests.
public void serialize(PartitionKeyInternal partitionKey, JsonGenerator writer, SerializerProvider serializerProvider) { try { if (partitionKey.equals(PartitionKeyInternal.getExclusiveMaximum())) { writer.writeString(INFINITY); return; } if (partitionKey.getComponents() != null) { writer.writeStartArray(); for (IPartiti...
writer.writeEndArray();
public void serialize(PartitionKeyInternal partitionKey, JsonGenerator writer, SerializerProvider serializerProvider) { try { if (partitionKey.equals(PartitionKeyInternal.getExclusiveMaximum())) { writer.writeString(INFINITY); return; } if (partitionKey.getComponents() != null) { writer.writeStartArray(); for (IPartiti...
class PartitionKeyInternalJsonSerializer extends StdSerializer<PartitionKeyInternal> { private static final long serialVersionUID = 2258093043805843865L; protected PartitionKeyInternalJsonSerializer() { this(null); } protected PartitionKeyInternalJsonSerializer(Class<PartitionKeyInternal> t) { super(t); } @Override sta...
class PartitionKeyInternalJsonSerializer extends StdSerializer<PartitionKeyInternal> { private static final long serialVersionUID = 2258093043805843865L; protected PartitionKeyInternalJsonSerializer() { this(null); } protected PartitionKeyInternalJsonSerializer(Class<PartitionKeyInternal> t) { super(t); } @Override sta...
This code path will always throw IllegalStateException - because we are always passing empty string - here is the issue - https://github.com/Azure/azure-sdk-for-java/issues/9053
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId(); getLocalSession...
String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId();
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { getLocalSessionToken(request, sessionToken, StringUtils.EMPTY); request.getHeaders().remove(HttpConsta...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
Sure, will do.
public void serialize(PartitionKeyInternal partitionKey, JsonGenerator writer, SerializerProvider serializerProvider) { try { if (partitionKey.equals(PartitionKeyInternal.getExclusiveMaximum())) { writer.writeString(INFINITY); return; } if (partitionKey.getComponents() != null) { writer.writeStartArray(); for (IPartiti...
writer.writeEndArray();
public void serialize(PartitionKeyInternal partitionKey, JsonGenerator writer, SerializerProvider serializerProvider) { try { if (partitionKey.equals(PartitionKeyInternal.getExclusiveMaximum())) { writer.writeString(INFINITY); return; } if (partitionKey.getComponents() != null) { writer.writeStartArray(); for (IPartiti...
class PartitionKeyInternalJsonSerializer extends StdSerializer<PartitionKeyInternal> { private static final long serialVersionUID = 2258093043805843865L; protected PartitionKeyInternalJsonSerializer() { this(null); } protected PartitionKeyInternalJsonSerializer(Class<PartitionKeyInternal> t) { super(t); } @Override sta...
class PartitionKeyInternalJsonSerializer extends StdSerializer<PartitionKeyInternal> { private static final long serialVersionUID = 2258093043805843865L; protected PartitionKeyInternalJsonSerializer() { this(null); } protected PartitionKeyInternalJsonSerializer(Class<PartitionKeyInternal> t) { super(t); } @Override sta...
@kushagraThapar https://github.com/Azure/azure-sdk-for-java/issues/9053 is for the PartitionKey.None is that right link?
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId(); getLocalSession...
String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId();
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { getLocalSessionToken(request, sessionToken, StringUtils.EMPTY); request.getHeaders().remove(HttpConsta...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
Yes, my bad. Here is the right link - https://github.com/Azure/azure-sdk-for-java/issues/10493
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId(); getLocalSession...
String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId();
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { getLocalSessionToken(request, sessionToken, StringUtils.EMPTY); request.getHeaders().remove(HttpConsta...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
Added unit test.
public void serialize(PartitionKeyInternal partitionKey, JsonGenerator writer, SerializerProvider serializerProvider) { try { if (partitionKey.equals(PartitionKeyInternal.getExclusiveMaximum())) { writer.writeString(INFINITY); return; } if (partitionKey.getComponents() != null) { writer.writeStartArray(); for (IPartiti...
writer.writeEndArray();
public void serialize(PartitionKeyInternal partitionKey, JsonGenerator writer, SerializerProvider serializerProvider) { try { if (partitionKey.equals(PartitionKeyInternal.getExclusiveMaximum())) { writer.writeString(INFINITY); return; } if (partitionKey.getComponents() != null) { writer.writeStartArray(); for (IPartiti...
class PartitionKeyInternalJsonSerializer extends StdSerializer<PartitionKeyInternal> { private static final long serialVersionUID = 2258093043805843865L; protected PartitionKeyInternalJsonSerializer() { this(null); } protected PartitionKeyInternalJsonSerializer(Class<PartitionKeyInternal> t) { super(t); } @Override sta...
class PartitionKeyInternalJsonSerializer extends StdSerializer<PartitionKeyInternal> { private static final long serialVersionUID = 2258093043805843865L; protected PartitionKeyInternalJsonSerializer() { this(null); } protected PartitionKeyInternalJsonSerializer(Class<PartitionKeyInternal> t) { super(t); } @Override sta...
@kirankumarkolli @kushagraThapar .Net seem to be doing the same thing as we used to do here: SessionTokenHelper.cs: ```java public static void ValidateAndRemoveSessionToken(DocumentServiceRequest request) { string sessionToken = request.Headers[HttpConstants.HttpHeaders.SessionToken]; if (!string.IsNullOrEmpt...
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId(); getLocalSession...
String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId();
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { getLocalSessionToken(request, sessionToken, StringUtils.EMPTY); request.getHeaders().remove(HttpConsta...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
True, but .Net doesn't throw Exception on passing empty partition key range id. Like we do: ``` if (partitionKeyRangeId == null || partitionKeyRangeId.isEmpty()) { // AddressCache/address resolution didn't produce partition key range id. // In this case it is a bug. throw new Illeg...
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId(); getLocalSession...
String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId();
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { getLocalSessionToken(request, sessionToken, StringUtils.EMPTY); request.getHeaders().remove(HttpConsta...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
Discussed offline with @moderakh Final logic is, we will just get rid of `partitionKeyRangeId.isEmpty()` check.
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId(); getLocalSession...
String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId();
public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) { String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); if (!Strings.isNullOrEmpty(sessionToken)) { getLocalSessionToken(request, sessionToken, StringUtils.EMPTY); request.getHeaders().remove(HttpConsta...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
class SessionTokenHelper { public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { if (request == null) { throw new IllegalArgumentException("request is null"); } if (originalSessionToken == null) { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN);...
log and throw
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.defer(() -> { if (cachedToken.get() != null) { return identityClient.authenticateWithMsalAccount(request, cachedToken.get()) .onErrorResume(t -> Mono.empty()); } else { return Mono.empty(); } }).switchIfEmpty( Mono.defer(() -> { if (!automatic...
+ "acquire token. Call Authenticate to initiate the device code authentication."));
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.defer(() -> { if (cachedToken.get() != null) { return identityClient.authenticateWithPublicClientCache(request, cachedToken.get()) .onErrorResume(t -> Mono.empty()); } else { return Mono.empty(); } }).switchIfEmpty( Mono.defer(() -> { if (!aut...
class DeviceCodeCredential implements TokenCredential { private final Consumer<DeviceCodeInfo> challengeConsumer; private final IdentityClient identityClient; private final AtomicReference<MsalAuthenticationAccount> cachedToken; private final String authorityHost; private final boolean automaticAuthentication; /** * Cr...
class DeviceCodeCredential implements TokenCredential { private final Consumer<DeviceCodeInfo> challengeConsumer; private final IdentityClient identityClient; private final AtomicReference<MsalAuthenticationAccount> cachedToken; private final String authorityHost; private final boolean automaticAuthentication; private ...
Shouldn't the exception carry `request` so the application can pass it on to `authenticate`?
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.defer(() -> { if (cachedToken.get() != null) { return identityClient.authenticateWithMsalAccount(request, cachedToken.get()) .onErrorResume(t -> Mono.empty()); } else { return Mono.empty(); } }).switchIfEmpty( Mono.defer(() -> { if (!automatic...
+ "acquire token. Call Authenticate to initiate the device code authentication."));
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.defer(() -> { if (cachedToken.get() != null) { return identityClient.authenticateWithPublicClientCache(request, cachedToken.get()) .onErrorResume(t -> Mono.empty()); } else { return Mono.empty(); } }).switchIfEmpty( Mono.defer(() -> { if (!aut...
class DeviceCodeCredential implements TokenCredential { private final Consumer<DeviceCodeInfo> challengeConsumer; private final IdentityClient identityClient; private final AtomicReference<MsalAuthenticationAccount> cachedToken; private final String authorityHost; private final boolean automaticAuthentication; /** * Cr...
class DeviceCodeCredential implements TokenCredential { private final Consumer<DeviceCodeInfo> challengeConsumer; private final IdentityClient identityClient; private final AtomicReference<MsalAuthenticationAccount> cachedToken; private final String authorityHost; private final boolean automaticAuthentication; private ...
Yeah, added it.
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.defer(() -> { if (cachedToken.get() != null) { return identityClient.authenticateWithMsalAccount(request, cachedToken.get()) .onErrorResume(t -> Mono.empty()); } else { return Mono.empty(); } }).switchIfEmpty( Mono.defer(() -> { if (!automatic...
+ "acquire token. Call Authenticate to initiate the device code authentication."));
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.defer(() -> { if (cachedToken.get() != null) { return identityClient.authenticateWithPublicClientCache(request, cachedToken.get()) .onErrorResume(t -> Mono.empty()); } else { return Mono.empty(); } }).switchIfEmpty( Mono.defer(() -> { if (!aut...
class DeviceCodeCredential implements TokenCredential { private final Consumer<DeviceCodeInfo> challengeConsumer; private final IdentityClient identityClient; private final AtomicReference<MsalAuthenticationAccount> cachedToken; private final String authorityHost; private final boolean automaticAuthentication; /** * Cr...
class DeviceCodeCredential implements TokenCredential { private final Consumer<DeviceCodeInfo> challengeConsumer; private final IdentityClient identityClient; private final AtomicReference<MsalAuthenticationAccount> cachedToken; private final String authorityHost; private final boolean automaticAuthentication; private ...
Do you mean to keep this?
public void testValidAuthenticate() throws Exception { Random random = new Random(); String token1 = "token1"; TokenRequestContext request1 = new TokenRequestContext().addScopes("https: OffsetDateTime expiresAt = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); int port = random.nextInt(10000) + 10000; IdentityClient i...
public void testValidAuthenticate() throws Exception { Random random = new Random(); String token1 = "token1"; TokenRequestContext request1 = new TokenRequestContext().addScopes("https: OffsetDateTime expiresAt = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); int port = random.nextInt(10000) + 10000; IdentityClient i...
class InteractiveBrowserCredentialTest { private final String tenantId = "contoso.com"; private final String clientId = UUID.randomUUID().toString(); @Test public void testValidInteractive() throws Exception { Random random = new Random(); String token1 = "token1"; String token2 = "token2"; TokenRequestContext request1...
class InteractiveBrowserCredentialTest { private final String tenantId = "contoso.com"; private final String clientId = UUID.randomUUID().toString(); @Test public void testValidInteractive() throws Exception { Random random = new Random(); String token1 = "token1"; String token2 = "token2"; TokenRequestContext request1...
Instead of converting instant to OffsetDateTime, its better to add this helper method in Utils.java which directly takes Instant and formats it. ``` public static String instantAsUTCRFC1123(Instant instant){ return Utils.RFC_1123_DATE_TIME.format(instant); } ```
private RxDocumentServiceRequest createDocumentServiceRequest(String continuationToken, int pageSize) { Map<String, String> headers = new HashMap<>(); RxDocumentServiceRequest req = RxDocumentServiceRequest.create( OperationType.ReadFeed, resourceType, documentsLink, headers, options); if (options.getMaxItemCount() != ...
String dateTimeInHttpFormat = Utils.zonedDateTimeAsUTCRFC1123(options.getStartDateTime().atOffset(ZoneOffset.UTC));
private RxDocumentServiceRequest createDocumentServiceRequest(String continuationToken, int pageSize) { Map<String, String> headers = new HashMap<>(); RxDocumentServiceRequest req = RxDocumentServiceRequest.create( OperationType.ReadFeed, resourceType, documentsLink, headers, options); if (options.getMaxItemCount() != ...
class ChangeFeedQueryImpl<T extends Resource> { private static final String IfNonMatchAllHeaderValue = "*"; private final RxDocumentClientImpl client; private final ResourceType resourceType; private final Class<T> klass; private final String documentsLink; private final ChangeFeedOptions options; public ChangeFeedQuer...
class ChangeFeedQueryImpl<T extends Resource> { private static final String IfNonMatchAllHeaderValue = "*"; private final RxDocumentClientImpl client; private final ResourceType resourceType; private final Class<T> klass; private final String documentsLink; private final ChangeFeedOptions options; public ChangeFeedQuer...
why are we doing translation from ZoneDateTime to Instant? can't we rely on Instant everywhere? @simplynaveen20 @milismsft
public static ServiceItemLease fromDocument(CosmosItemProperties document) { ServiceItemLease lease = new ServiceItemLease() .withId(document.getId()) .withETag(document.getETag()) .withTs(ModelBridgeInternal.getStringFromJsonSerializable(document, Constants.Properties.LAST_MODIFIED)) .withOwner(ModelBridgeInternal.get...
return lease.withTimestamp(ZonedDateTime.parse(leaseTimestamp).toInstant());
public static ServiceItemLease fromDocument(CosmosItemProperties document) { ServiceItemLease lease = new ServiceItemLease() .withId(document.getId()) .withETag(document.getETag()) .withTs(ModelBridgeInternal.getStringFromJsonSerializable(document, Constants.Properties.LAST_MODIFIED)) .withOwner(ModelBridgeInternal.get...
class ServiceItemLease implements Lease { private static final ZonedDateTime UNIX_START_TIME = ZonedDateTime.parse("1970-01-01T00:00:00.0Z[UTC]"); private static final String PROPERTY_NAME_LEASE_TOKEN = "LeaseToken"; private static final String PROPERTY_NAME_CONTINUATION_TOKEN = "ContinuationToken"; private static fina...
class ServiceItemLease implements Lease { private static final ZonedDateTime UNIX_START_TIME = ZonedDateTime.parse("1970-01-01T00:00:00.0Z[UTC]"); private static final String PROPERTY_NAME_LEASE_TOKEN = "LeaseToken"; private static final String PROPERTY_NAME_CONTINUATION_TOKEN = "ContinuationToken"; private static fina...
Discussed with Milis, we are serializing and deserializing the same way it was happening before , also text coming from service is in DateTime format which cant be parse with Instant, it will throw exception
public static ServiceItemLease fromDocument(CosmosItemProperties document) { ServiceItemLease lease = new ServiceItemLease() .withId(document.getId()) .withETag(document.getETag()) .withTs(ModelBridgeInternal.getStringFromJsonSerializable(document, Constants.Properties.LAST_MODIFIED)) .withOwner(ModelBridgeInternal.get...
return lease.withTimestamp(ZonedDateTime.parse(leaseTimestamp).toInstant());
public static ServiceItemLease fromDocument(CosmosItemProperties document) { ServiceItemLease lease = new ServiceItemLease() .withId(document.getId()) .withETag(document.getETag()) .withTs(ModelBridgeInternal.getStringFromJsonSerializable(document, Constants.Properties.LAST_MODIFIED)) .withOwner(ModelBridgeInternal.get...
class ServiceItemLease implements Lease { private static final ZonedDateTime UNIX_START_TIME = ZonedDateTime.parse("1970-01-01T00:00:00.0Z[UTC]"); private static final String PROPERTY_NAME_LEASE_TOKEN = "LeaseToken"; private static final String PROPERTY_NAME_CONTINUATION_TOKEN = "ContinuationToken"; private static fina...
class ServiceItemLease implements Lease { private static final ZonedDateTime UNIX_START_TIME = ZonedDateTime.parse("1970-01-01T00:00:00.0Z[UTC]"); private static final String PROPERTY_NAME_LEASE_TOKEN = "LeaseToken"; private static final String PROPERTY_NAME_CONTINUATION_TOKEN = "ContinuationToken"; private static fina...
DateTime format cannot parse with Instant , we need zone time info , it will give runtime exception. Also we it cant be compatible with existing lease if we change the format. https://stackoverflow.com/questions/25229124/format-instant-to-string
private RxDocumentServiceRequest createDocumentServiceRequest(String continuationToken, int pageSize) { Map<String, String> headers = new HashMap<>(); RxDocumentServiceRequest req = RxDocumentServiceRequest.create( OperationType.ReadFeed, resourceType, documentsLink, headers, options); if (options.getMaxItemCount() != ...
String dateTimeInHttpFormat = Utils.zonedDateTimeAsUTCRFC1123(options.getStartDateTime().atOffset(ZoneOffset.UTC));
private RxDocumentServiceRequest createDocumentServiceRequest(String continuationToken, int pageSize) { Map<String, String> headers = new HashMap<>(); RxDocumentServiceRequest req = RxDocumentServiceRequest.create( OperationType.ReadFeed, resourceType, documentsLink, headers, options); if (options.getMaxItemCount() != ...
class ChangeFeedQueryImpl<T extends Resource> { private static final String IfNonMatchAllHeaderValue = "*"; private final RxDocumentClientImpl client; private final ResourceType resourceType; private final Class<T> klass; private final String documentsLink; private final ChangeFeedOptions options; public ChangeFeedQuer...
class ChangeFeedQueryImpl<T extends Resource> { private static final String IfNonMatchAllHeaderValue = "*"; private final RxDocumentClientImpl client; private final ResourceType resourceType; private final Class<T> klass; private final String documentsLink; private final ChangeFeedOptions options; public ChangeFeedQuer...
Does Search offer anonymous access? I thought a key would always need to be set.
public SearchAsyncClient buildAsyncClient() { Objects.requireNonNull(indexName, "'indexName' cannot be null."); Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); SearchServiceVersion buildVersion = (serviceVersion == null) ? SearchServiceVersion.getLatest() : serviceVersion; if (httpPipeline != null) { re...
if (keyCredential != null) {
public SearchAsyncClient buildAsyncClient() { Objects.requireNonNull(indexName, "'indexName' cannot be null."); Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); SearchServiceVersion buildVersion = (serviceVersion == null) ? SearchServiceVersion.getLatest() : serviceVersion; if (httpPipeline != null) { re...
class SearchClientBuilder { private static final String API_KEY = "api-key"; /* * This header tells the service to return the request ID in the HTTP response. This is useful for correlating the * request sent to the response. */ private static final String ECHO_REQUEST_ID_HEADER = "return-client-request-id"; private st...
class SearchClientBuilder { private static final String API_KEY = "api-key"; /* * This header tells the service to return the request ID in the HTTP response. This is useful for correlating the * request sent to the response. */ private static final String ECHO_REQUEST_ID_HEADER = "return-client-request-id"; private st...
Do we normally add the `User-Agent` at the end of the pipeline? I thought this normally was added when setting the request ID since it'll be static throughout the request/requests (if retried) being made.
public SearchAsyncClient buildAsyncClient() { Objects.requireNonNull(indexName, "'indexName' cannot be null."); Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); SearchServiceVersion buildVersion = (serviceVersion == null) ? SearchServiceVersion.getLatest() : serviceVersion; if (httpPipeline != null) { re...
httpPipelinePolicies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion,
public SearchAsyncClient buildAsyncClient() { Objects.requireNonNull(indexName, "'indexName' cannot be null."); Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); SearchServiceVersion buildVersion = (serviceVersion == null) ? SearchServiceVersion.getLatest() : serviceVersion; if (httpPipeline != null) { re...
class SearchClientBuilder { private static final String API_KEY = "api-key"; /* * This header tells the service to return the request ID in the HTTP response. This is useful for correlating the * request sent to the response. */ private static final String ECHO_REQUEST_ID_HEADER = "return-client-request-id"; private st...
class SearchClientBuilder { private static final String API_KEY = "api-key"; /* * This header tells the service to return the request ID in the HTTP response. This is useful for correlating the * request sent to the response. */ private static final String ECHO_REQUEST_ID_HEADER = "return-client-request-id"; private st...
Should update the exception message here as `null` with throw a different exception.
public SearchClientBuilder credential(AzureKeyCredential keyCredential) { if (keyCredential == null) { throw logger.logExceptionAsError(new NullPointerException("'keyCredential' cannot be null.")); } if (CoreUtils.isNullOrEmpty(keyCredential.getKey())) { throw logger.logExceptionAsError( new IllegalArgumentException("'...
new IllegalArgumentException("'keyCredential' cannot have a null or empty API key."));
public SearchClientBuilder credential(AzureKeyCredential keyCredential) { if (keyCredential == null) { throw logger.logExceptionAsError(new NullPointerException("'keyCredential' cannot be null.")); } if (CoreUtils.isNullOrEmpty(keyCredential.getKey())) { throw logger.logExceptionAsError( new IllegalArgumentException("'...
class SearchClientBuilder { private static final String API_KEY = "api-key"; /* * This header tells the service to return the request ID in the HTTP response. This is useful for correlating the * request sent to the response. */ private static final String ECHO_REQUEST_ID_HEADER = "return-client-request-id"; private st...
class SearchClientBuilder { private static final String API_KEY = "api-key"; /* * This header tells the service to return the request ID in the HTTP response. This is useful for correlating the * request sent to the response. */ private static final String ECHO_REQUEST_ID_HEADER = "return-client-request-id"; private st...
Should we look into updating other methods which use `Objects.requireNonNull` to log their error?
public SearchClientBuilder credential(AzureKeyCredential keyCredential) { if (keyCredential == null) { throw logger.logExceptionAsError(new NullPointerException("'keyCredential' cannot be null.")); } if (CoreUtils.isNullOrEmpty(keyCredential.getKey())) { throw logger.logExceptionAsError( new IllegalArgumentException("'...
if (keyCredential == null) {
public SearchClientBuilder credential(AzureKeyCredential keyCredential) { if (keyCredential == null) { throw logger.logExceptionAsError(new NullPointerException("'keyCredential' cannot be null.")); } if (CoreUtils.isNullOrEmpty(keyCredential.getKey())) { throw logger.logExceptionAsError( new IllegalArgumentException("'...
class SearchClientBuilder { private static final String API_KEY = "api-key"; /* * This header tells the service to return the request ID in the HTTP response. This is useful for correlating the * request sent to the response. */ private static final String ECHO_REQUEST_ID_HEADER = "return-client-request-id"; private st...
class SearchClientBuilder { private static final String API_KEY = "api-key"; /* * This header tells the service to return the request ID in the HTTP response. This is useful for correlating the * request sent to the response. */ private static final String ECHO_REQUEST_ID_HEADER = "return-client-request-id"; private st...
Missed the comments here. Will address these in a new PR.
public SearchAsyncClient buildAsyncClient() { Objects.requireNonNull(indexName, "'indexName' cannot be null."); Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); SearchServiceVersion buildVersion = (serviceVersion == null) ? SearchServiceVersion.getLatest() : serviceVersion; if (httpPipeline != null) { re...
if (keyCredential != null) {
public SearchAsyncClient buildAsyncClient() { Objects.requireNonNull(indexName, "'indexName' cannot be null."); Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); SearchServiceVersion buildVersion = (serviceVersion == null) ? SearchServiceVersion.getLatest() : serviceVersion; if (httpPipeline != null) { re...
class SearchClientBuilder { private static final String API_KEY = "api-key"; /* * This header tells the service to return the request ID in the HTTP response. This is useful for correlating the * request sent to the response. */ private static final String ECHO_REQUEST_ID_HEADER = "return-client-request-id"; private st...
class SearchClientBuilder { private static final String API_KEY = "api-key"; /* * This header tells the service to return the request ID in the HTTP response. This is useful for correlating the * request sent to the response. */ private static final String ECHO_REQUEST_ID_HEADER = "return-client-request-id"; private st...
https://github.com/Azure/azure-sdk-for-java/pull/11497
public SearchAsyncClient buildAsyncClient() { Objects.requireNonNull(indexName, "'indexName' cannot be null."); Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); SearchServiceVersion buildVersion = (serviceVersion == null) ? SearchServiceVersion.getLatest() : serviceVersion; if (httpPipeline != null) { re...
if (keyCredential != null) {
public SearchAsyncClient buildAsyncClient() { Objects.requireNonNull(indexName, "'indexName' cannot be null."); Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); SearchServiceVersion buildVersion = (serviceVersion == null) ? SearchServiceVersion.getLatest() : serviceVersion; if (httpPipeline != null) { re...
class SearchClientBuilder { private static final String API_KEY = "api-key"; /* * This header tells the service to return the request ID in the HTTP response. This is useful for correlating the * request sent to the response. */ private static final String ECHO_REQUEST_ID_HEADER = "return-client-request-id"; private st...
class SearchClientBuilder { private static final String API_KEY = "api-key"; /* * This header tells the service to return the request ID in the HTTP response. This is useful for correlating the * request sent to the response. */ private static final String ECHO_REQUEST_ID_HEADER = "return-client-request-id"; private st...
Would we want to use a parallelization that is more idiomatic to the Storage service usage? I know `Queues.SMALL_BUFFER_SIZE` aligns more with Reactor's usage but could the higher level of parallelization get use into issues.
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null, null) : other; if (other.getBlockSize() != null) { StorageImplUtils.assertInBounds("ParallelTransferOptions.blockSize", other.getBlockSize(), 1, MAX_APPEN...
other.getMaxConcurrency() == null ? Integer.valueOf(Queues.SMALL_BUFFER_SIZE) : other.getMaxConcurrency());
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null, null) : other; if (other.getBlockSize() != null) { StorageImplUtils.assertInBounds("ParallelTransferOptions.blockSize", other.getBlockSize(), 1, MAX_APPEN...
class ModelHelper { /** * Indicates the maximum number of bytes that can be sent in a call to upload. */ private static final int MAX_APPEND_FILE_BYTES = 100 * Constants.MB; /** * The block size to use if none is specified in parallel operations. */ private static final int FILE_DEFAULT_UPLOAD_BLOCK_SIZE = 4 * Constant...
class ModelHelper { /** * Indicates the maximum number of bytes that can be sent in a call to upload. */ private static final int MAX_APPEND_FILE_BYTES = 100 * Constants.MB; /** * The block size to use if none is specified in parallel operations. */ private static final int FILE_DEFAULT_UPLOAD_BLOCK_SIZE = 4 * Constant...
Same comment about what the default should be.
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null) : other; return new ParallelTransferOptions( other.getBlockSize() == null ? Integer.valueOf(BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : other.getBlo...
other.getMaxConcurrency() == null ? Integer.valueOf(Queues.SMALL_BUFFER_SIZE) : other.getMaxConcurrency());
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null) : other; return new ParallelTransferOptions( other.getBlockSize() == null ? Integer.valueOf(BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : other.getBlo...
class ModelHelper { /** * Determines whether or not the passed authority is IP style, that is, it is of the format {@code <host>:<port>}. * * @param authority The authority of a URL. * @throws MalformedURLException If the authority is malformed. * @return Whether the authority is IP style. */ public static boolean dete...
class ModelHelper { /** * Determines whether or not the passed authority is IP style, that is, it is of the format {@code <host>:<port>}. * * @param authority The authority of a URL. * @throws MalformedURLException If the authority is malformed. * @return Whether the authority is IP style. */ public static boolean dete...
Fair point. It is true that accepting this default is what hurt one the customer who filed the issue and why we're making this change. But that also seems like a fairly rare case so far? And I'm not sure what a more idiomatic value for Storage would be. It feels like anything we choose would just be a guess.
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null, null) : other; if (other.getBlockSize() != null) { StorageImplUtils.assertInBounds("ParallelTransferOptions.blockSize", other.getBlockSize(), 1, MAX_APPEN...
other.getMaxConcurrency() == null ? Integer.valueOf(Queues.SMALL_BUFFER_SIZE) : other.getMaxConcurrency());
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null, null) : other; if (other.getBlockSize() != null) { StorageImplUtils.assertInBounds("ParallelTransferOptions.blockSize", other.getBlockSize(), 1, MAX_APPEN...
class ModelHelper { /** * Indicates the maximum number of bytes that can be sent in a call to upload. */ private static final int MAX_APPEND_FILE_BYTES = 100 * Constants.MB; /** * The block size to use if none is specified in parallel operations. */ private static final int FILE_DEFAULT_UPLOAD_BLOCK_SIZE = 4 * Constant...
class ModelHelper { /** * Indicates the maximum number of bytes that can be sent in a call to upload. */ private static final int MAX_APPEND_FILE_BYTES = 100 * Constants.MB; /** * The block size to use if none is specified in parallel operations. */ private static final int FILE_DEFAULT_UPLOAD_BLOCK_SIZE = 4 * Constant...
https://github.com/reactor/reactor-core/blob/6058a391f614de6213fb85970272fc5b342bd181/reactor-core/src/main/java/reactor/util/concurrent/Queues.java#L88 Looks like that'd be 256 by default. Pretty high. We limit number of buffers. Shouldn't max concurrency == numBuffers ? Or maxConcurrency be <= numbBuffers with numB...
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null) : other; return new ParallelTransferOptions( other.getBlockSize() == null ? Integer.valueOf(BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : other.getBlo...
other.getMaxConcurrency() == null ? Integer.valueOf(Queues.SMALL_BUFFER_SIZE) : other.getMaxConcurrency());
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null) : other; return new ParallelTransferOptions( other.getBlockSize() == null ? Integer.valueOf(BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : other.getBlo...
class ModelHelper { /** * Determines whether or not the passed authority is IP style, that is, it is of the format {@code <host>:<port>}. * * @param authority The authority of a URL. * @throws MalformedURLException If the authority is malformed. * @return Whether the authority is IP style. */ public static boolean dete...
class ModelHelper { /** * Determines whether or not the passed authority is IP style, that is, it is of the format {@code <host>:<port>}. * * @param authority The authority of a URL. * @throws MalformedURLException If the authority is malformed. * @return Whether the authority is IP style. */ public static boolean dete...
https://github.com/reactor/reactor-core/blob/6058a391f614de6213fb85970272fc5b342bd181/reactor-core/src/main/java/reactor/util/concurrent/Queues.java#L88 Looks like that'd be 256 by default. Pretty high. We limit number of buffers. Shouldn't max concurrency == numBuffers ? Or maxConcurrency be <= numbBuffers with numB...
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null, null) : other; if (other.getBlockSize() != null) { StorageImplUtils.assertInBounds("ParallelTransferOptions.blockSize", other.getBlockSize(), 1, MAX_APPEN...
other.getMaxConcurrency() == null ? Integer.valueOf(Queues.SMALL_BUFFER_SIZE) : other.getMaxConcurrency());
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null, null) : other; if (other.getBlockSize() != null) { StorageImplUtils.assertInBounds("ParallelTransferOptions.blockSize", other.getBlockSize(), 1, MAX_APPEN...
class ModelHelper { /** * Indicates the maximum number of bytes that can be sent in a call to upload. */ private static final int MAX_APPEND_FILE_BYTES = 100 * Constants.MB; /** * The block size to use if none is specified in parallel operations. */ private static final int FILE_DEFAULT_UPLOAD_BLOCK_SIZE = 4 * Constant...
class ModelHelper { /** * Indicates the maximum number of bytes that can be sent in a call to upload. */ private static final int MAX_APPEND_FILE_BYTES = 100 * Constants.MB; /** * The block size to use if none is specified in parallel operations. */ private static final int FILE_DEFAULT_UPLOAD_BLOCK_SIZE = 4 * Constant...
I don't think we should set them to equal because numBuffers isn't used in every parallel operation, so it's not quite the same. 256 does sound high, but again we haven't seen OOM errors before even with this default. On the other hand, it's probably better to err on the side of being a little slower than running out o...
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null) : other; return new ParallelTransferOptions( other.getBlockSize() == null ? Integer.valueOf(BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : other.getBlo...
other.getMaxConcurrency() == null ? Integer.valueOf(Queues.SMALL_BUFFER_SIZE) : other.getMaxConcurrency());
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null) : other; return new ParallelTransferOptions( other.getBlockSize() == null ? Integer.valueOf(BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : other.getBlo...
class ModelHelper { /** * Determines whether or not the passed authority is IP style, that is, it is of the format {@code <host>:<port>}. * * @param authority The authority of a URL. * @throws MalformedURLException If the authority is malformed. * @return Whether the authority is IP style. */ public static boolean dete...
class ModelHelper { /** * Determines whether or not the passed authority is IP style, that is, it is of the format {@code <host>:<port>}. * * @param authority The authority of a URL. * @throws MalformedURLException If the authority is malformed. * @return Whether the authority is IP style. */ public static boolean dete...
In v10/11 we defaulted to 5. It was completely arbitrary, but how does that sound here?
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null) : other; return new ParallelTransferOptions( other.getBlockSize() == null ? Integer.valueOf(BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : other.getBlo...
other.getMaxConcurrency() == null ? Integer.valueOf(Queues.SMALL_BUFFER_SIZE) : other.getMaxConcurrency());
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions(null, null, null) : other; return new ParallelTransferOptions( other.getBlockSize() == null ? Integer.valueOf(BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : other.getBlo...
class ModelHelper { /** * Determines whether or not the passed authority is IP style, that is, it is of the format {@code <host>:<port>}. * * @param authority The authority of a URL. * @throws MalformedURLException If the authority is malformed. * @return Whether the authority is IP style. */ public static boolean dete...
class ModelHelper { /** * Determines whether or not the passed authority is IP style, that is, it is of the format {@code <host>:<port>}. * * @param authority The authority of a URL. * @throws MalformedURLException If the authority is malformed. * @return Whether the authority is IP style. */ public static boolean dete...
result validation validates page size, etc. that may fail. you need to update the validation section.
public void readUserDefinedFunctions() throws Exception { int maxItemCount = 2; CosmosPagedFlux<CosmosUserDefinedFunctionProperties> feedObservable = createdCollection.getScripts() .readAllUserDefinedFunctions(); int expectedPageSize = (createdUserDefinedFunctions.size() + maxItemCount - 1) / maxItemCount; FeedResponse...
.readAllUserDefinedFunctions();
public void readUserDefinedFunctions() throws Exception { int maxItemCount = 2; CosmosPagedFlux<CosmosUserDefinedFunctionProperties> feedObservable = createdCollection.getScripts() .readAllUserDefinedFunctions(); int expectedPageSize = (createdUserDefinedFunctions.size() + maxItemCount - 1) / maxItemCount; FeedResponse...
class ReadFeedUdfsTest extends TestSuiteBase { private Database createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosUserDefinedFunctionProperties> createdUserDefinedFunctions = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuildersWithDirect") public...
class ReadFeedUdfsTest extends TestSuiteBase { private Database createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosUserDefinedFunctionProperties> createdUserDefinedFunctions = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuildersWithDirect") public...
result validation validates page size, etc. that may fail. you need to update the validation section.
public void readUsers() throws Exception { int maxItemCount = 2; CosmosPagedFlux<CosmosUserProperties> feedObservable = createdDatabase.readAllUsers(); int expectedPageSize = (createdUsers.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator<CosmosUserProperties> validator = new FeedResponseListValidato...
int expectedPageSize = (createdUsers.size() + maxItemCount - 1) / maxItemCount;
public void readUsers() throws Exception { int maxItemCount = 2; CosmosPagedFlux<CosmosUserProperties> feedObservable = createdDatabase.readAllUsers(); int expectedPageSize = (createdUsers.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator<CosmosUserProperties> validator = new FeedResponseListValidato...
class ReadFeedUsersTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private CosmosAsyncDatabase createdDatabase; private CosmosAsyncClient client; private List<CosmosUserProperties> createdUsers = new ArrayList<>(); @Factory(dataProvider = "clientBuilders") public ReadFe...
class ReadFeedUsersTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private CosmosAsyncDatabase createdDatabase; private CosmosAsyncClient client; private List<CosmosUserProperties> createdUsers = new ArrayList<>(); @Factory(dataProvider = "clientBuilders") public ReadFe...
the page size validation may fail. ```java int expectedPageSize = (allDatabases.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator<CosmosDatabaseProperties> validator = new FeedResponseListValidator.Builder<CosmosDatabaseProperties>() .totalSize(allDatabases.size()) ...
public void readDatabases() throws Exception { int maxItemCount = 2; CosmosPagedFlux<CosmosDatabaseProperties> feedObservable = client.readAllDatabases(); int expectedPageSize = (allDatabases.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator<CosmosDatabaseProperties> validator = new FeedResponseListV...
int expectedPageSize = (allDatabases.size() + maxItemCount - 1) / maxItemCount;
public void readDatabases() throws Exception { int maxItemCount = 2; CosmosPagedFlux<CosmosDatabaseProperties> feedObservable = client.readAllDatabases(); int expectedPageSize = (allDatabases.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator<CosmosDatabaseProperties> validator = new FeedResponseListV...
class ReadFeedDatabasesTest extends TestSuiteBase { private List<CosmosDatabaseProperties> createdDatabases = new ArrayList<>(); private List<CosmosDatabaseProperties> allDatabases = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuilders") public ReadFeedDatabasesTest(CosmosClientB...
class ReadFeedDatabasesTest extends TestSuiteBase { private List<CosmosDatabaseProperties> createdDatabases = new ArrayList<>(); private List<CosmosDatabaseProperties> allDatabases = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuilders") public ReadFeedDatabasesTest(CosmosClientB...
I'm not seeing any test failures when run locally... I'm not sure I understand the concern since we already moved the maxItemCount out of the FeedOptions when we transitioned to return PageFlux results... Plus under the new API we do exactly what the test does, which is to call the now package private readAll*() API wi...
public void readDatabases() throws Exception { int maxItemCount = 2; CosmosPagedFlux<CosmosDatabaseProperties> feedObservable = client.readAllDatabases(); int expectedPageSize = (allDatabases.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator<CosmosDatabaseProperties> validator = new FeedResponseListV...
int expectedPageSize = (allDatabases.size() + maxItemCount - 1) / maxItemCount;
public void readDatabases() throws Exception { int maxItemCount = 2; CosmosPagedFlux<CosmosDatabaseProperties> feedObservable = client.readAllDatabases(); int expectedPageSize = (allDatabases.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator<CosmosDatabaseProperties> validator = new FeedResponseListV...
class ReadFeedDatabasesTest extends TestSuiteBase { private List<CosmosDatabaseProperties> createdDatabases = new ArrayList<>(); private List<CosmosDatabaseProperties> allDatabases = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuilders") public ReadFeedDatabasesTest(CosmosClientB...
class ReadFeedDatabasesTest extends TestSuiteBase { private List<CosmosDatabaseProperties> createdDatabases = new ArrayList<>(); private List<CosmosDatabaseProperties> allDatabases = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuilders") public ReadFeedDatabasesTest(CosmosClientB...
Page sizes are controlled by maxItemCount which is no longer part of the FeedOptions since when we start returning PageFlux as results.
public void readUsers() throws Exception { int maxItemCount = 2; CosmosPagedFlux<CosmosUserProperties> feedObservable = createdDatabase.readAllUsers(); int expectedPageSize = (createdUsers.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator<CosmosUserProperties> validator = new FeedResponseListValidato...
int expectedPageSize = (createdUsers.size() + maxItemCount - 1) / maxItemCount;
public void readUsers() throws Exception { int maxItemCount = 2; CosmosPagedFlux<CosmosUserProperties> feedObservable = createdDatabase.readAllUsers(); int expectedPageSize = (createdUsers.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator<CosmosUserProperties> validator = new FeedResponseListValidato...
class ReadFeedUsersTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private CosmosAsyncDatabase createdDatabase; private CosmosAsyncClient client; private List<CosmosUserProperties> createdUsers = new ArrayList<>(); @Factory(dataProvider = "clientBuilders") public ReadFe...
class ReadFeedUsersTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private CosmosAsyncDatabase createdDatabase; private CosmosAsyncClient client; private List<CosmosUserProperties> createdUsers = new ArrayList<>(); @Factory(dataProvider = "clientBuilders") public ReadFe...
Page sizes are controlled by maxItemCount which is no longer part of the FeedOptions since when we start returning PageFlux as results.
public void readUserDefinedFunctions() throws Exception { int maxItemCount = 2; CosmosPagedFlux<CosmosUserDefinedFunctionProperties> feedObservable = createdCollection.getScripts() .readAllUserDefinedFunctions(); int expectedPageSize = (createdUserDefinedFunctions.size() + maxItemCount - 1) / maxItemCount; FeedResponse...
.readAllUserDefinedFunctions();
public void readUserDefinedFunctions() throws Exception { int maxItemCount = 2; CosmosPagedFlux<CosmosUserDefinedFunctionProperties> feedObservable = createdCollection.getScripts() .readAllUserDefinedFunctions(); int expectedPageSize = (createdUserDefinedFunctions.size() + maxItemCount - 1) / maxItemCount; FeedResponse...
class ReadFeedUdfsTest extends TestSuiteBase { private Database createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosUserDefinedFunctionProperties> createdUserDefinedFunctions = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuildersWithDirect") public...
class ReadFeedUdfsTest extends TestSuiteBase { private Database createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosUserDefinedFunctionProperties> createdUserDefinedFunctions = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuildersWithDirect") public...
We are replacing `getResourceId()` -> with `getId()` Can you please make sure these tests pass ? Here and everywhere else in your changes ?
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
.exactlyContainsInAnyOrder(expectedUsers.stream().map(CosmosUserProperties::getId).collect(Collectors.toList()))
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
Please don't replace this in the tests. ResourceId is a unique value, however id may not necessary be unique. To access package private getResource you can use BridgeInternal if needed. please roll back these changes.
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
.exactlyContainsInAnyOrder(expectedUsers.stream().map(CosmosUserProperties::getId).collect(Collectors.toList()))
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
So basically what this comes to is that UUID.randomUUID().toString() does not generate unique IDs??? If yes than we have a bigger problem through the whole test bed.
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
.exactlyContainsInAnyOrder(expectedUsers.stream().map(CosmosUserProperties::getId).collect(Collectors.toList()))
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
Milis, are you taking into account that ID may not necessarily be unique across multiple partitions?
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
.exactlyContainsInAnyOrder(expectedUsers.stream().map(CosmosUserProperties::getId).collect(Collectors.toList()))
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
The IDs for all those tests are generated using the API I just mentioned; they pretty much should be unique as they come out from it. The second thing is that there are no partition setting that are applicable to databases, containers, container scripts for instance. All these tests use the IDs to count the results (se...
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
.exactlyContainsInAnyOrder(expectedUsers.stream().map(CosmosUserProperties::getId).collect(Collectors.toList()))
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
@milismsft as the goal of the PR is to change the public api, I suggest we don't change how tests work. If you have thought on improving the tests please consider anything other than public api change outside of the PR for public api change. as a pattern we rely on resourceId to ensure we cover having same id across ...
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
.exactlyContainsInAnyOrder(expectedUsers.stream().map(CosmosUserProperties::getId).collect(Collectors.toList()))
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
`FeedResponseListValidator.exactlyContainsInAnyOrder` uses resourceId internally for validation. now on your side you are passing Id and on the other side it compares against resoruceId, I suspect the tests will fail. if you don't want to go with BridgeInternal approach for non-partitioned resources please use `FeedR...
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
.exactlyContainsInAnyOrder(expectedUsers.stream().map(CosmosUserProperties::getId).collect(Collectors.toList()))
public void queryAllUsers() throws Exception { String query = "SELECT * from c"; FeedOptions options = new FeedOptions(); int maxItemCount = 2; String databaseLink = TestUtils.getDatabaseNameLink(databaseId); CosmosPagedFlux<CosmosUserProperties> queryObservable = createdDatabase.queryUsers(query, options); List<Cosmos...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
class UserQueryTest extends TestSuiteBase { public final String databaseId = CosmosDatabaseForTest.generateId(); private List<CosmosUserProperties> createdUsers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") public UserQueryT...
```suggestion return OperationKind.DELETE == conflict.getOperationKind()); ```
private boolean isDelete(Conflict conflict) { return StringUtils.equalsIgnoreCase(conflict.getOperationKind().toString(), "delete"); }
return StringUtils.equalsIgnoreCase(conflict.getOperationKind().toString(), "delete");
private boolean isDelete(Conflict conflict) { return OperationKind.DELETE == conflict.getOperationKind(); }
class ConflictWorker { private static Logger logger = LoggerFactory.getLogger(ConflictWorker.class); private final Scheduler schedulerForBlockingWork; private final List<AsyncDocumentClient> clients; private final String basicCollectionUri; private final String manualCollectionUri; private final String lwwCollectionUri...
class ConflictWorker { private static Logger logger = LoggerFactory.getLogger(ConflictWorker.class); private final Scheduler schedulerForBlockingWork; private final List<AsyncDocumentClient> clients; private final String basicCollectionUri; private final String manualCollectionUri; private final String lwwCollectionUri...
can we have more `/` in the path ? if yes then should we encode them?
public static String encodeUrlPath(String url) { /* Deconstruct the URL and reconstruct it making sure the path is encoded. */ UrlBuilder builder = UrlBuilder.parse(url); String path = builder.getPath(); if (path.startsWith("/")) { path = path.substring(1); } path = Utility.urlEncode(Utility.urlDecode(path)); builder.s...
if (path.startsWith("/")) {
public static String encodeUrlPath(String url) { /* Deconstruct the URL and reconstruct it making sure the path is encoded. */ UrlBuilder builder = UrlBuilder.parse(url); String path = builder.getPath(); if (path.startsWith("/")) { path = path.substring(1); } path = Utility.urlEncode(Utility.urlDecode(path)); builder.s...
class Utility { private static final ClientLogger LOGGER = new ClientLogger(Utility.class); private static final String UTF8_CHARSET = "UTF-8"; private static final String INVALID_DATE_STRING = "Invalid Date String: %s."; public static final String STORAGE_TRACING_NAMESPACE_VALUE = "Microsoft.Storage"; /** * Stores a r...
class Utility { private static final ClientLogger LOGGER = new ClientLogger(Utility.class); private static final String UTF8_CHARSET = "UTF-8"; private static final String INVALID_DATE_STRING = "Invalid Date String: %s."; public static final String STORAGE_TRACING_NAMESPACE_VALUE = "Microsoft.Storage"; /** * Stores a r...
do we have to decode it first ? Wouldn't already encoded chars be left alone during encoding?
public static String encodeUrlPath(String url) { /* Deconstruct the URL and reconstruct it making sure the path is encoded. */ UrlBuilder builder = UrlBuilder.parse(url); String path = builder.getPath(); if (path.startsWith("/")) { path = path.substring(1); } path = Utility.urlEncode(Utility.urlDecode(path)); builder.s...
path = Utility.urlEncode(Utility.urlDecode(path));
public static String encodeUrlPath(String url) { /* Deconstruct the URL and reconstruct it making sure the path is encoded. */ UrlBuilder builder = UrlBuilder.parse(url); String path = builder.getPath(); if (path.startsWith("/")) { path = path.substring(1); } path = Utility.urlEncode(Utility.urlDecode(path)); builder.s...
class Utility { private static final ClientLogger LOGGER = new ClientLogger(Utility.class); private static final String UTF8_CHARSET = "UTF-8"; private static final String INVALID_DATE_STRING = "Invalid Date String: %s."; public static final String STORAGE_TRACING_NAMESPACE_VALUE = "Microsoft.Storage"; /** * Stores a r...
class Utility { private static final ClientLogger LOGGER = new ClientLogger(Utility.class); private static final String UTF8_CHARSET = "UTF-8"; private static final String INVALID_DATE_STRING = "Invalid Date String: %s."; public static final String STORAGE_TRACING_NAMESPACE_VALUE = "Microsoft.Storage"; /** * Stores a r...