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
will update in a separate PR.
public void deleteKey() { }
public void deleteKey() { deleteKeyRunner((keyToDelete) -> { StepVerifier.create(client.createKey(keyToDelete)) .assertNext(keyResponse -> assertKeyEquals(keyToDelete, keyResponse)).verifyComplete(); Poller<DeletedKey, Void> poller = client.beginDeleteKey(keyToDelete.getName()); poller.blockUntil(PollResponse.Operation...
class KeyAsyncClientTest extends KeyClientTestBase { private KeyAsyncClient client; @Override protected void beforeTest() { beforeTestSetup(); if (interceptorManager.isPlaybackMode()) { client = clientSetup(pipeline -> new KeyClientBuilder() .vaultEndpoint(getEndpoint()) .pipeline(pipeline) .buildAsyncClient()); } else...
class KeyAsyncClientTest extends KeyClientTestBase { private KeyAsyncClient client; @Override protected void beforeTest() { beforeTestSetup(); if (interceptorManager.isPlaybackMode()) { client = clientSetup(pipeline -> new KeyClientBuilder() .vaultUrl(getEndpoint()) .pipeline(pipeline) .buildAsyncClient()); } else { cl...
Need to pass the exception object.
public SecretClientBuilder vaultUrl(String vaultUrl) { try { this.vaultUrl = new URL(vaultUrl); } catch (MalformedURLException e) { throw logger.logExceptionAsError(new IllegalArgumentException( "The Azure Key Vault endpoint url is malformed.")); } return this; }
throw logger.logExceptionAsError(new IllegalArgumentException(
public SecretClientBuilder vaultUrl(String vaultUrl) { try { this.vaultUrl = new URL(vaultUrl); } catch (MalformedURLException e) { throw logger.logExceptionAsError(new IllegalArgumentException( "The Azure Key Vault url is malformed.", e)); } return this; }
class SecretClientBuilder { private final ClientLogger logger = new ClientLogger(SecretClientBuilder.class); private final List<HttpPipelinePolicy> policies; private TokenCredential credential; private HttpPipeline pipeline; private URL vaultUrl; private HttpClient httpClient; private HttpLogOptions httpLogOptions; pri...
class SecretClientBuilder { private final ClientLogger logger = new ClientLogger(SecretClientBuilder.class); private final List<HttpPipelinePolicy> policies; private TokenCredential credential; private HttpPipeline pipeline; private URL vaultUrl; private HttpClient httpClient; private HttpLogOptions httpLogOptions; pri...
updated
public SecretClientBuilder vaultUrl(String vaultUrl) { try { this.vaultUrl = new URL(vaultUrl); } catch (MalformedURLException e) { throw logger.logExceptionAsError(new IllegalArgumentException( "The Azure Key Vault endpoint url is malformed.")); } return this; }
throw logger.logExceptionAsError(new IllegalArgumentException(
public SecretClientBuilder vaultUrl(String vaultUrl) { try { this.vaultUrl = new URL(vaultUrl); } catch (MalformedURLException e) { throw logger.logExceptionAsError(new IllegalArgumentException( "The Azure Key Vault url is malformed.", e)); } return this; }
class SecretClientBuilder { private final ClientLogger logger = new ClientLogger(SecretClientBuilder.class); private final List<HttpPipelinePolicy> policies; private TokenCredential credential; private HttpPipeline pipeline; private URL vaultUrl; private HttpClient httpClient; private HttpLogOptions httpLogOptions; pri...
class SecretClientBuilder { private final ClientLogger logger = new ClientLogger(SecretClientBuilder.class); private final List<HttpPipelinePolicy> policies; private TokenCredential credential; private HttpPipeline pipeline; private URL vaultUrl; private HttpClient httpClient; private HttpLogOptions httpLogOptions; pri...
Is this an optimization thing?
private static String getCanonicalName(String account, String queueName) { return String.join("", new String[] { "/queue/", account, "/", queueName }); }
return String.join("", new String[] { "/queue/", account, "/", queueName });
private static String getCanonicalName(String account, String queueName) { return String.join("", new String[] { "/queue/", account, "/", queueName }); }
class level JavaDocs.</p> * @param storageSharedKeyCredentials A {@link StorageSharedKeyCredential}
class level JavaDocs.</p> * * @param storageSharedKeyCredentials A {@link StorageSharedKeyCredential}
```suggestion ? String.format("/file/%s/%s/%s", account, shareName, filePath.replace("\\", "/")) ```
private static String getCanonicalName(String account, String shareName, String filePath) { return ImplUtils.isNullOrEmpty(filePath) ? String.format("/file/%s/%s/%s",account, shareName, filePath.replace("\\", "/")) : String.format("/file/%s/%s",account, shareName); }
? String.format("/file/%s/%s/%s",account, shareName, filePath.replace("\\", "/"))
private static String getCanonicalName(String account, String shareName, String filePath) { return !ImplUtils.isNullOrEmpty(filePath) ? String.format("/file/%s/%s/%s", account, shareName, filePath.replace("\\", "/")) : String.format("/file/%s/%s", account, shareName); }
class level JavaDocs for code snippets. * * @param storageSharedKeyCredentials A {@link StorageSharedKeyCredential}
class level JavaDocs for code snippets.</p> * * @param storageSharedKeyCredentials A {@link StorageSharedKeyCredential}
```suggestion : String.format("/file/%s/%s", account, shareName); ```
private static String getCanonicalName(String account, String shareName, String filePath) { return ImplUtils.isNullOrEmpty(filePath) ? String.format("/file/%s/%s/%s",account, shareName, filePath.replace("\\", "/")) : String.format("/file/%s/%s",account, shareName); }
: String.format("/file/%s/%s",account, shareName);
private static String getCanonicalName(String account, String shareName, String filePath) { return !ImplUtils.isNullOrEmpty(filePath) ? String.format("/file/%s/%s/%s", account, shareName, filePath.replace("\\", "/")) : String.format("/file/%s/%s", account, shareName); }
class level JavaDocs for code snippets. * * @param storageSharedKeyCredentials A {@link StorageSharedKeyCredential}
class level JavaDocs for code snippets.</p> * * @param storageSharedKeyCredentials A {@link StorageSharedKeyCredential}
ACCOUNT_NAME_NAME sounds a little weird, might need some doc.
public EncryptedBlobClientBuilder connectionString(String connectionString) { Objects.requireNonNull(connectionString, "'connectionString' cannot be null."); Map<String, String> connectionStringPieces = Utility.parseConnectionString(connectionString); String accountName = connectionStringPieces.get(Constants.Connection...
String accountName = connectionStringPieces.get(Constants.ConnectionStringConstants.ACCOUNT_NAME_NAME);
public EncryptedBlobClientBuilder connectionString(String connectionString) { StorageConnectionString storageConnectionString = StorageConnectionString.create(connectionString, logger); StorageEndpoint endpoint = storageConnectionString.getBlobEndpoint(); if (endpoint == null || endpoint.getPrimaryUri() == null) { thro...
class EncryptedBlobClientBuilder { private final ClientLogger logger = new ClientLogger(EncryptedBlobClientBuilder.class); private String endpoint; private String accountName; private String containerName; private String blobName; private String snapshot; private StorageSharedKeyCredential storageSharedKeyCredential; p...
class EncryptedBlobClientBuilder { private final ClientLogger logger = new ClientLogger(EncryptedBlobClientBuilder.class); private String endpoint; private String accountName; private String containerName; private String blobName; private String snapshot; private StorageSharedKeyCredential storageSharedKeyCredential; p...
Why do we use different way of constructing endpoint here compare to blob, file..?
public EncryptedBlobClientBuilder connectionString(String connectionString) { Objects.requireNonNull(connectionString, "'connectionString' cannot be null."); Map<String, String> connectionStringPieces = Utility.parseConnectionString(connectionString); String accountName = connectionStringPieces.get(Constants.Connection...
String endpointProtocol
public EncryptedBlobClientBuilder connectionString(String connectionString) { StorageConnectionString storageConnectionString = StorageConnectionString.create(connectionString, logger); StorageEndpoint endpoint = storageConnectionString.getBlobEndpoint(); if (endpoint == null || endpoint.getPrimaryUri() == null) { thro...
class EncryptedBlobClientBuilder { private final ClientLogger logger = new ClientLogger(EncryptedBlobClientBuilder.class); private String endpoint; private String accountName; private String containerName; private String blobName; private String snapshot; private StorageSharedKeyCredential storageSharedKeyCredential; p...
class EncryptedBlobClientBuilder { private final ClientLogger logger = new ClientLogger(EncryptedBlobClientBuilder.class); private String endpoint; private String accountName; private String containerName; private String blobName; private String snapshot; private StorageSharedKeyCredential storageSharedKeyCredential; p...
If account name and key not null, then get into the block. No need to check sas, right?
public static StorageAuthenticationSettings fromConnectionSettings(final ConnectionSettings settings) { final String accountName = settings.getSettingValue(Constants.ConnectionStringConstants.ACCOUNT_NAME_NAME); final String accountKey = settings.getSettingValue(Constants.ConnectionStringConstants.ACCOUNT_KEY_NAME); fi...
if (accountName != null && accountKey != null && sasSignature == null) {
public static StorageAuthenticationSettings fromConnectionSettings(final ConnectionSettings settings) { final String accountName = settings.getSettingValue(Constants.ConnectionStringConstants.ACCOUNT_NAME); final String accountKey = settings.getSettingValue(Constants.ConnectionStringConstants.ACCOUNT_KEY_NAME); final S...
class StorageAuthenticationSettings { private final Type type; private final String sasToken; private final Account account; /** * @return the settings type (None, Account Name and Key, Sas token) */ public Type getType() { return this.type; } /** * @return the sas token */ public String getSasToken() { return this.sas...
class StorageAuthenticationSettings { private final Type type; private final String sasToken; private final Account account; /** * @return the settings type (None, Account Name and Key, Sas token) */ public Type getType() { return this.type; } /** * @return the sas token */ public String getSasToken() { return this.sas...
yes, I'm about to update the PR to use `StorageConnectionString` type here as well that also removes parseConnectionString from Utility.
public EncryptedBlobClientBuilder connectionString(String connectionString) { Objects.requireNonNull(connectionString, "'connectionString' cannot be null."); Map<String, String> connectionStringPieces = Utility.parseConnectionString(connectionString); String accountName = connectionStringPieces.get(Constants.Connection...
String endpointProtocol
public EncryptedBlobClientBuilder connectionString(String connectionString) { StorageConnectionString storageConnectionString = StorageConnectionString.create(connectionString, logger); StorageEndpoint endpoint = storageConnectionString.getBlobEndpoint(); if (endpoint == null || endpoint.getPrimaryUri() == null) { thro...
class EncryptedBlobClientBuilder { private final ClientLogger logger = new ClientLogger(EncryptedBlobClientBuilder.class); private String endpoint; private String accountName; private String containerName; private String blobName; private String snapshot; private StorageSharedKeyCredential storageSharedKeyCredential; p...
class EncryptedBlobClientBuilder { private final ClientLogger logger = new ClientLogger(EncryptedBlobClientBuilder.class); private String endpoint; private String accountName; private String containerName; private String blobName; private String snapshot; private StorageSharedKeyCredential storageSharedKeyCredential; p...
Actually as per validation rules - {account name:key} and {Sas} are mutually exclusive, we do that validation already on connection string, here it is just reinforcing for readability.
public static StorageAuthenticationSettings fromConnectionSettings(final ConnectionSettings settings) { final String accountName = settings.getSettingValue(Constants.ConnectionStringConstants.ACCOUNT_NAME_NAME); final String accountKey = settings.getSettingValue(Constants.ConnectionStringConstants.ACCOUNT_KEY_NAME); fi...
if (accountName != null && accountKey != null && sasSignature == null) {
public static StorageAuthenticationSettings fromConnectionSettings(final ConnectionSettings settings) { final String accountName = settings.getSettingValue(Constants.ConnectionStringConstants.ACCOUNT_NAME); final String accountKey = settings.getSettingValue(Constants.ConnectionStringConstants.ACCOUNT_KEY_NAME); final S...
class StorageAuthenticationSettings { private final Type type; private final String sasToken; private final Account account; /** * @return the settings type (None, Account Name and Key, Sas token) */ public Type getType() { return this.type; } /** * @return the sas token */ public String getSasToken() { return this.sas...
class StorageAuthenticationSettings { private final Type type; private final String sasToken; private final Account account; /** * @return the settings type (None, Account Name and Key, Sas token) */ public Type getType() { return this.type; } /** * @return the sas token */ public String getSasToken() { return this.sas...
agree, will name it to `ACCOUNT_NAME`
public EncryptedBlobClientBuilder connectionString(String connectionString) { Objects.requireNonNull(connectionString, "'connectionString' cannot be null."); Map<String, String> connectionStringPieces = Utility.parseConnectionString(connectionString); String accountName = connectionStringPieces.get(Constants.Connection...
String accountName = connectionStringPieces.get(Constants.ConnectionStringConstants.ACCOUNT_NAME_NAME);
public EncryptedBlobClientBuilder connectionString(String connectionString) { StorageConnectionString storageConnectionString = StorageConnectionString.create(connectionString, logger); StorageEndpoint endpoint = storageConnectionString.getBlobEndpoint(); if (endpoint == null || endpoint.getPrimaryUri() == null) { thro...
class EncryptedBlobClientBuilder { private final ClientLogger logger = new ClientLogger(EncryptedBlobClientBuilder.class); private String endpoint; private String accountName; private String containerName; private String blobName; private String snapshot; private StorageSharedKeyCredential storageSharedKeyCredential; p...
class EncryptedBlobClientBuilder { private final ClientLogger logger = new ClientLogger(EncryptedBlobClientBuilder.class); private String endpoint; private String accountName; private String containerName; private String blobName; private String snapshot; private StorageSharedKeyCredential storageSharedKeyCredential; p...
This should just call into the next overload so we don't have to worry about missing formatting/encoding logic in one of them
public Response<Void> deleteBlob(String containerName, String blobName) { return deleteBlobHelper(String.format(PATH_TEMPLATE, containerName, Utility.urlEncode(Utility.urlDecode(blobName))), null, null); }
return deleteBlobHelper(String.format(PATH_TEMPLATE, containerName,
public Response<Void> deleteBlob(String containerName, String blobName) { return deleteBlobHelper(String.format(PATH_TEMPLATE, containerName, Utility.urlEncode(Utility.urlDecode(blobName))), null, null); }
class BlobBatch { private static final String X_MS_VERSION = "x-ms-version"; private static final String BATCH_REQUEST_CONTENT_ID = "Batch-Request-Content-Id"; private static final String BATCH_REQUEST_URL_PATH = "Batch-Request-Url-Path"; private static final String CONTENT_ID = "Content-Id"; private static final Strin...
class BlobBatch { private static final String X_MS_VERSION = "x-ms-version"; private static final String BATCH_REQUEST_CONTENT_ID = "Batch-Request-Content-Id"; private static final String BATCH_REQUEST_URL_PATH = "Batch-Request-Url-Path"; private static final String CONTENT_ID = "Content-Id"; private static final Strin...
Same comment about calling the next overload.
public Response<Void> setBlobAccessTier(String containerName, String blobName, AccessTier accessTier) { return setBlobAccessTierHelper(String.format(PATH_TEMPLATE, containerName, Utility.urlEncode(Utility.urlDecode(blobName))), accessTier, null); }
return setBlobAccessTierHelper(String.format(PATH_TEMPLATE, containerName,
public Response<Void> setBlobAccessTier(String containerName, String blobName, AccessTier accessTier) { return setBlobAccessTierHelper(String.format(PATH_TEMPLATE, containerName, Utility.urlEncode(Utility.urlDecode(blobName))), accessTier, null); }
class BlobBatch { private static final String X_MS_VERSION = "x-ms-version"; private static final String BATCH_REQUEST_CONTENT_ID = "Batch-Request-Content-Id"; private static final String BATCH_REQUEST_URL_PATH = "Batch-Request-Url-Path"; private static final String CONTENT_ID = "Content-Id"; private static final Strin...
class BlobBatch { private static final String X_MS_VERSION = "x-ms-version"; private static final String BATCH_REQUEST_CONTENT_ID = "Batch-Request-Content-Id"; private static final String BATCH_REQUEST_URL_PATH = "Batch-Request-Url-Path"; private static final String CONTENT_ID = "Content-Id"; private static final Strin...
Overload to skip encoding?
public BlobUrlParts setBlobName(String blobName) { this.blobName = Utility.urlEncode(Utility.urlDecode(blobName)); return this; }
this.blobName = Utility.urlEncode(Utility.urlDecode(blobName));
public BlobUrlParts setBlobName(String blobName) { this.blobName = Utility.urlEncode(Utility.urlDecode(blobName)); return this; }
class BlobUrlParts { private static final Pattern IP_V4_URL_PATTERN = Pattern .compile("(?:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(?:localhost)"); private final ClientLogger logger = new ClientLogger(BlobUrlParts.class); private String scheme; private String host; private String containerName; private String blobNa...
class BlobUrlParts { private static final Pattern IP_V4_URL_PATTERN = Pattern .compile("(?:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(?:localhost)"); private final ClientLogger logger = new ClientLogger(BlobUrlParts.class); private String scheme; private String host; private String containerName; private String blobNa...
You are right, let's make it call the next overload.
public Response<Void> deleteBlob(String containerName, String blobName) { return deleteBlobHelper(String.format(PATH_TEMPLATE, containerName, Utility.urlEncode(Utility.urlDecode(blobName))), null, null); }
return deleteBlobHelper(String.format(PATH_TEMPLATE, containerName,
public Response<Void> deleteBlob(String containerName, String blobName) { return deleteBlobHelper(String.format(PATH_TEMPLATE, containerName, Utility.urlEncode(Utility.urlDecode(blobName))), null, null); }
class BlobBatch { private static final String X_MS_VERSION = "x-ms-version"; private static final String BATCH_REQUEST_CONTENT_ID = "Batch-Request-Content-Id"; private static final String BATCH_REQUEST_URL_PATH = "Batch-Request-Url-Path"; private static final String CONTENT_ID = "Content-Id"; private static final Strin...
class BlobBatch { private static final String X_MS_VERSION = "x-ms-version"; private static final String BATCH_REQUEST_CONTENT_ID = "Batch-Request-Content-Id"; private static final String BATCH_REQUEST_URL_PATH = "Batch-Request-Url-Path"; private static final String CONTENT_ID = "Content-Id"; private static final Strin...
See answer about overloads and double encoding above.
public BlobUrlParts setBlobName(String blobName) { this.blobName = Utility.urlEncode(Utility.urlDecode(blobName)); return this; }
this.blobName = Utility.urlEncode(Utility.urlDecode(blobName));
public BlobUrlParts setBlobName(String blobName) { this.blobName = Utility.urlEncode(Utility.urlDecode(blobName)); return this; }
class BlobUrlParts { private static final Pattern IP_V4_URL_PATTERN = Pattern .compile("(?:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(?:localhost)"); private final ClientLogger logger = new ClientLogger(BlobUrlParts.class); private String scheme; private String host; private String containerName; private String blobNa...
class BlobUrlParts { private static final Pattern IP_V4_URL_PATTERN = Pattern .compile("(?:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(?:localhost)"); private final ClientLogger logger = new ClientLogger(BlobUrlParts.class); private String scheme; private String host; private String containerName; private String blobNa...
we could possibly introduce KVCredentialPolicy in the pipeline and pass in default azure credential there instead of the builder. This will showcae better use of custom pipeline
public CryptographyAsyncClient createAsyncClientWithPipeline() { HttpPipeline pipeline = new HttpPipelineBuilder().build(); CryptographyAsyncClient cryptographyAsyncClient = new CryptographyClientBuilder() .pipeline(pipeline) .keyIdentifier("<YOUR-KEY-ID") .credential(new DefaultAzureCredentialBuilder().build()) .build...
HttpPipeline pipeline = new HttpPipelineBuilder().build();
public CryptographyAsyncClient createAsyncClientWithPipeline() { HttpPipeline pipeline = new HttpPipelineBuilder().build(); CryptographyAsyncClient cryptographyAsyncClient = new CryptographyClientBuilder() .pipeline(pipeline) .keyIdentifier("<YOUR-KEY-ID") .credential(new DefaultAzureCredentialBuilder().build()) .build...
class CryptographyAsyncClientJavaDocCodeSnippets { private String key1 = "key1"; private String key2 = "key2"; private String value1 = "val1"; private String value2 = "val2"; /** * Generates code sample for creating a {@link KeyAsyncClient} * @return An instance of {@link KeyAsyncClient} */ public CryptographyAsyncClie...
class CryptographyAsyncClientJavaDocCodeSnippets { private String key1 = "key1"; private String key2 = "key2"; private String value1 = "val1"; private String value2 = "val2"; /** * Generates code sample for creating a {@link KeyAsyncClient} * @return An instance of {@link KeyAsyncClient} */ public CryptographyAsyncClie...
Discussed offline with @g2vinay . He has updates to the code snippets in his PR - #5701
public CryptographyAsyncClient createAsyncClientWithPipeline() { HttpPipeline pipeline = new HttpPipelineBuilder().build(); CryptographyAsyncClient cryptographyAsyncClient = new CryptographyClientBuilder() .pipeline(pipeline) .keyIdentifier("<YOUR-KEY-ID") .credential(new DefaultAzureCredentialBuilder().build()) .build...
HttpPipeline pipeline = new HttpPipelineBuilder().build();
public CryptographyAsyncClient createAsyncClientWithPipeline() { HttpPipeline pipeline = new HttpPipelineBuilder().build(); CryptographyAsyncClient cryptographyAsyncClient = new CryptographyClientBuilder() .pipeline(pipeline) .keyIdentifier("<YOUR-KEY-ID") .credential(new DefaultAzureCredentialBuilder().build()) .build...
class CryptographyAsyncClientJavaDocCodeSnippets { private String key1 = "key1"; private String key2 = "key2"; private String value1 = "val1"; private String value2 = "val2"; /** * Generates code sample for creating a {@link KeyAsyncClient} * @return An instance of {@link KeyAsyncClient} */ public CryptographyAsyncClie...
class CryptographyAsyncClientJavaDocCodeSnippets { private String key1 = "key1"; private String key2 = "key2"; private String value1 = "val1"; private String value2 = "val2"; /** * Generates code sample for creating a {@link KeyAsyncClient} * @return An instance of {@link KeyAsyncClient} */ public CryptographyAsyncClie...
nit: anyway to avoid the same exact code being written 3x in this file? otherwise lgtm
public void streamByPageSnippet() { CustomPagedFlux<String> customPagedFlux = createCustomInstance(); PagedIterableBase<String, PagedResponse<String>> customPagedIterableResponse = new PagedIterableBase<>(customPagedFlux); customPagedIterableResponse.streamByPage().forEach(resp -> { System.out.printf("Response headers ...
System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.getHeaders(),
public void streamByPageSnippet() { CustomPagedFlux<String> customPagedFlux = createCustomInstance(); PagedIterableBase<String, PagedResponse<String>> customPagedIterableResponse = new PagedIterableBase<>(customPagedFlux); customPagedIterableResponse.streamByPage().forEach(resp -> { System.out.printf("Response headers ...
class CustomPagedFlux<String> extends PagedFluxBase<String, PagedResponse<String>> { CustomPagedFlux(Supplier<Mono<PagedResponse<String>>> firstPageRetriever) { super(firstPageRetriever); } CustomPagedFlux(Supplier<Mono<PagedResponse<String>>> firstPageRetriever, Function<java.lang.String, Mono<PagedResponse<String>>> ...
class CustomPagedFlux<String> extends PagedFluxBase<String, PagedResponse<String>> { CustomPagedFlux(Supplier<Mono<PagedResponse<String>>> firstPageRetriever) { super(firstPageRetriever); } CustomPagedFlux(Supplier<Mono<PagedResponse<String>>> firstPageRetriever, Function<java.lang.String, Mono<PagedResponse<String>>> ...
These are code snippets that get inserted into our Javadocs. They all have unique codesnippet tags and get inserted for different methods. So, in this case, when viewed on javadocs will provide a clear self-contained sample at the cost of a bit of duplication.
public void streamByPageSnippet() { CustomPagedFlux<String> customPagedFlux = createCustomInstance(); PagedIterableBase<String, PagedResponse<String>> customPagedIterableResponse = new PagedIterableBase<>(customPagedFlux); customPagedIterableResponse.streamByPage().forEach(resp -> { System.out.printf("Response headers ...
System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.getHeaders(),
public void streamByPageSnippet() { CustomPagedFlux<String> customPagedFlux = createCustomInstance(); PagedIterableBase<String, PagedResponse<String>> customPagedIterableResponse = new PagedIterableBase<>(customPagedFlux); customPagedIterableResponse.streamByPage().forEach(resp -> { System.out.printf("Response headers ...
class CustomPagedFlux<String> extends PagedFluxBase<String, PagedResponse<String>> { CustomPagedFlux(Supplier<Mono<PagedResponse<String>>> firstPageRetriever) { super(firstPageRetriever); } CustomPagedFlux(Supplier<Mono<PagedResponse<String>>> firstPageRetriever, Function<java.lang.String, Mono<PagedResponse<String>>> ...
class CustomPagedFlux<String> extends PagedFluxBase<String, PagedResponse<String>> { CustomPagedFlux(Supplier<Mono<PagedResponse<String>>> firstPageRetriever) { super(firstPageRetriever); } CustomPagedFlux(Supplier<Mono<PagedResponse<String>>> firstPageRetriever, Function<java.lang.String, Mono<PagedResponse<String>>> ...
Seems like this could also be hit if there are no accounts no? Perhaps this is confusing if the user didn't specify username or AZURE_USERNAME
public Mono<AccessToken> getToken(TokenRequestContext request) { if (pubClient == null) { try { PersistentTokenCacheAccessAspect accessAspect = new PersistentTokenCacheAccessAspect(); pubClient = PublicClientApplication.builder(this.clientID) .setTokenCacheAccessAspect(accessAspect) .build(); } catch (Exception e) { re...
return Mono.error(new RuntimeException("Requested account was not found"));
public Mono<AccessToken> getToken(TokenRequestContext request) { if (pubClient == null) { try { PersistentTokenCacheAccessAspect accessAspect = new PersistentTokenCacheAccessAspect(); pubClient = PublicClientApplication.builder(this.clientID) .setTokenCacheAccessAspect(accessAspect) .build(); } catch (Exception e) { re...
class SharedTokenCacheCredential implements TokenCredential { private final String username; private final String clientID; private final Configuration configuration; private PublicClientApplication pubClient; /** * Creates an instance of the Shared Token Cache Credential Provider. * * @param username the username of t...
class SharedTokenCacheCredential implements TokenCredential { private final String username; private final String clientID; private final Configuration configuration; private PublicClientApplication pubClient; /** * Creates an instance of the Shared Token Cache Credential Provider. * * @param username the username of t...
Same kind of issue here. If the username wasn't specified this message wouldn't read right.
public Mono<AccessToken> getToken(TokenRequestContext request) { if (pubClient == null) { try { PersistentTokenCacheAccessAspect accessAspect = new PersistentTokenCacheAccessAspect(); pubClient = PublicClientApplication.builder(this.clientID) .setTokenCacheAccessAspect(accessAspect) .build(); } catch (Exception e) { re...
+ " SharedTokenCacheCredential."));
public Mono<AccessToken> getToken(TokenRequestContext request) { if (pubClient == null) { try { PersistentTokenCacheAccessAspect accessAspect = new PersistentTokenCacheAccessAspect(); pubClient = PublicClientApplication.builder(this.clientID) .setTokenCacheAccessAspect(accessAspect) .build(); } catch (Exception e) { re...
class SharedTokenCacheCredential implements TokenCredential { private final String username; private final String clientID; private final Configuration configuration; private PublicClientApplication pubClient; /** * Creates an instance of the Shared Token Cache Credential Provider. * * @param username the username of t...
class SharedTokenCacheCredential implements TokenCredential { private final String username; private final String clientID; private final Configuration configuration; private PublicClientApplication pubClient; /** * Creates an instance of the Shared Token Cache Credential Provider. * * @param username the username of t...
Added better message
public Mono<AccessToken> getToken(TokenRequestContext request) { if (pubClient == null) { try { PersistentTokenCacheAccessAspect accessAspect = new PersistentTokenCacheAccessAspect(); pubClient = PublicClientApplication.builder(this.clientID) .setTokenCacheAccessAspect(accessAspect) .build(); } catch (Exception e) { re...
return Mono.error(new RuntimeException("Requested account was not found"));
public Mono<AccessToken> getToken(TokenRequestContext request) { if (pubClient == null) { try { PersistentTokenCacheAccessAspect accessAspect = new PersistentTokenCacheAccessAspect(); pubClient = PublicClientApplication.builder(this.clientID) .setTokenCacheAccessAspect(accessAspect) .build(); } catch (Exception e) { re...
class SharedTokenCacheCredential implements TokenCredential { private final String username; private final String clientID; private final Configuration configuration; private PublicClientApplication pubClient; /** * Creates an instance of the Shared Token Cache Credential Provider. * * @param username the username of t...
class SharedTokenCacheCredential implements TokenCredential { private final String username; private final String clientID; private final Configuration configuration; private PublicClientApplication pubClient; /** * Creates an instance of the Shared Token Cache Credential Provider. * * @param username the username of t...
Added better message
public Mono<AccessToken> getToken(TokenRequestContext request) { if (pubClient == null) { try { PersistentTokenCacheAccessAspect accessAspect = new PersistentTokenCacheAccessAspect(); pubClient = PublicClientApplication.builder(this.clientID) .setTokenCacheAccessAspect(accessAspect) .build(); } catch (Exception e) { re...
+ " SharedTokenCacheCredential."));
public Mono<AccessToken> getToken(TokenRequestContext request) { if (pubClient == null) { try { PersistentTokenCacheAccessAspect accessAspect = new PersistentTokenCacheAccessAspect(); pubClient = PublicClientApplication.builder(this.clientID) .setTokenCacheAccessAspect(accessAspect) .build(); } catch (Exception e) { re...
class SharedTokenCacheCredential implements TokenCredential { private final String username; private final String clientID; private final Configuration configuration; private PublicClientApplication pubClient; /** * Creates an instance of the Shared Token Cache Credential Provider. * * @param username the username of t...
class SharedTokenCacheCredential implements TokenCredential { private final String username; private final String clientID; private final Configuration configuration; private PublicClientApplication pubClient; /** * Creates an instance of the Shared Token Cache Credential Provider. * * @param username the username of t...
FYI, AccessModifier could be another way to define the modifier accessibility: ``` final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken(modifiersAST); ``` and ``` accessModifier.equals(AccessModifier.PUBLIC) ```
private boolean isPublicApi(DetailAST token) { final DetailAST modifiersAST = token.findFirstToken(TokenTypes.MODIFIERS); final boolean isStatic = modifiersAST.findFirstToken(TokenTypes.LITERAL_STATIC) != null; final boolean isPublic = modifiersAST .findFirstToken(TokenTypes.LITERAL_PUBLIC) != null; final boolean isPro...
final boolean isPublic = modifiersAST
private boolean isPublicApi(DetailAST token) { final DetailAST modifiersAST = token.findFirstToken(TokenTypes.MODIFIERS); final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken(modifiersAST); final boolean isStatic = modifiersAST.findFirstToken(TokenTypes.LITERAL_STATIC) != null; return (ac...
class BlacklistedWordsCheck extends AbstractCheck { private final Set<String> blacklistedWords = new HashSet<>(Arrays.asList()); private final String ERROR_MESSAGE = "%s, All Public API Classes, Fields and Methods should follow " + "Camelcase standards for the following words: %s."; /** * Adds words that Classes, Metho...
class BlacklistedWordsCheck extends AbstractCheck { private final Set<String> blacklistedWords = new HashSet<>(Arrays.asList()); private final String ERROR_MESSAGE = "%s, All Public API Classes, Fields and Methods should follow " + "Camelcase standards for the following words: %s."; /** * Adds words that Classes, Metho...
You can also return true here and return false at the end of method
private boolean hasBlacklistedWords(String tokenName) { boolean result = false; for (String blacklistedWord : blacklistedWords) { if (tokenName.contains(blacklistedWord)) { result = true; break; } } return result; }
result = true;
private boolean hasBlacklistedWords(String tokenName) { for (String blacklistedWord : blacklistedWords) { if (tokenName.contains(blacklistedWord)) { return true; } } return false; }
class BlacklistedWordsCheck extends AbstractCheck { private final Set<String> blacklistedWords = new HashSet<>(Arrays.asList()); private final String ERROR_MESSAGE = "%s, All Public API Classes, Fields and Methods should follow " + "Camelcase standards for the following words: %s."; /** * Adds words that Classes, Metho...
class BlacklistedWordsCheck extends AbstractCheck { private final Set<String> blacklistedWords = new HashSet<>(Arrays.asList()); private final String ERROR_MESSAGE = "%s, All Public API Classes, Fields and Methods should follow " + "Camelcase standards for the following words: %s."; /** * Adds words that Classes, Metho...
should use `importKeyWithResponse` here.
public void importKeySnippets() { KeyAsyncClient keyAsyncClient = createAsyncClient(); JsonWebKey jsonWebKeyToImport = new JsonWebKey(); keyAsyncClient.importKey("keyName", jsonWebKeyToImport).subscribe(keyResponse -> System.out.printf("Key is imported with name %s and id %s \n", keyResponse.getName(), keyResponse.getI...
keyAsyncClient.importKey(importKeyOptions).subscribe(keyResponse ->
public void importKeySnippets() { KeyAsyncClient keyAsyncClient = createAsyncClient(); JsonWebKey jsonWebKeyToImport = new JsonWebKey(); keyAsyncClient.importKey("keyName", jsonWebKeyToImport).subscribe(keyResponse -> System.out.printf("Key is imported with name %s and id %s \n", keyResponse.getName(), keyResponse.getI...
class KeyAsyncClientJavaDocCodeSnippets { private String key1 = "key1"; private String key2 = "key2"; private String value1 = "val1"; private String value2 = "val2"; /** * Generates code sample for creating a {@link KeyAsyncClient} * @return An instance of {@link KeyAsyncClient} */ public KeyAsyncClient createAsyncClie...
class KeyAsyncClientJavaDocCodeSnippets { private String key1 = "key1"; private String key2 = "key2"; private String value1 = "val1"; private String value2 = "val2"; /** * Generates code sample for creating a {@link KeyAsyncClient} * @return An instance of {@link KeyAsyncClient} */ public KeyAsyncClient createAsyncClie...
good catch, updated.
public void importKeySnippets() { KeyAsyncClient keyAsyncClient = createAsyncClient(); JsonWebKey jsonWebKeyToImport = new JsonWebKey(); keyAsyncClient.importKey("keyName", jsonWebKeyToImport).subscribe(keyResponse -> System.out.printf("Key is imported with name %s and id %s \n", keyResponse.getName(), keyResponse.getI...
keyAsyncClient.importKey(importKeyOptions).subscribe(keyResponse ->
public void importKeySnippets() { KeyAsyncClient keyAsyncClient = createAsyncClient(); JsonWebKey jsonWebKeyToImport = new JsonWebKey(); keyAsyncClient.importKey("keyName", jsonWebKeyToImport).subscribe(keyResponse -> System.out.printf("Key is imported with name %s and id %s \n", keyResponse.getName(), keyResponse.getI...
class KeyAsyncClientJavaDocCodeSnippets { private String key1 = "key1"; private String key2 = "key2"; private String value1 = "val1"; private String value2 = "val2"; /** * Generates code sample for creating a {@link KeyAsyncClient} * @return An instance of {@link KeyAsyncClient} */ public KeyAsyncClient createAsyncClie...
class KeyAsyncClientJavaDocCodeSnippets { private String key1 = "key1"; private String key2 = "key2"; private String value1 = "val1"; private String value2 = "val2"; /** * Generates code sample for creating a {@link KeyAsyncClient} * @return An instance of {@link KeyAsyncClient} */ public KeyAsyncClient createAsyncClie...
FluxUtils in azure-core has a convenience method for this `monoError(logger, ex)`
public Mono<Void> send(Iterable<EventData> events, SendOptions options) { if (events == null) { return Mono.error(logger.logExceptionAsError(new NullPointerException("'events' cannot be null."))); } else if (options == null) { return Mono.error(logger.logExceptionAsError(new NullPointerException("'options' cannot be nu...
return Mono.error(logger.logExceptionAsError(new NullPointerException("'events' cannot be null.")));
public Mono<Void> send(Iterable<EventData> events, SendOptions options) { if (events == null) { return monoError(logger, new NullPointerException("'events' cannot be null.")); } else if (options == null) { return monoError(logger, new NullPointerException("'options' cannot be null.")); } return send(Flux.fromIterable(e...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final BatchOptions DEFAULT_BATCH_OPTIONS...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final BatchOptions DEFAULT_BATCH_OPTIONS...
Instead of generating the file path, checking existence, failing or get the file why not use ```java File playbackFile = new File(folderFile, testName + ".json"); if (!playbackFile.exists()) { // throw exception } return playbackFile; ```
private File getRecordFile(String testName) { URL folderUrl = InterceptorManager.class.getClassLoader().getResource("."); File folderFile = new File(folderUrl.getPath() + RECORD_FOLDER); if (!folderFile.exists()) { if (folderFile.mkdir()) { logger.verbose("Created directory: {}", folderFile.getPath()); } } String fileP...
String filePath = folderFile.getPath() + "/" + testName + ".json";
private File getRecordFile(String testName) { URL folderUrl = InterceptorManager.class.getClassLoader().getResource("."); File folderFile = new File(folderUrl.getPath() + RECORD_FOLDER); if (!folderFile.exists()) { if (folderFile.mkdir()) { logger.verbose("Created directory: {}", folderFile.getPath()); } } File playbac...
class InterceptorManager implements AutoCloseable { private static final String RECORD_FOLDER = "session-records/"; private final ClientLogger logger = new ClientLogger(InterceptorManager.class); private final Map<String, String> textReplacementRules; private final String testName; private final TestMode testMode; priv...
class InterceptorManager implements AutoCloseable { private static final String RECORD_FOLDER = "session-records/"; private final ClientLogger logger = new ClientLogger(InterceptorManager.class); private final Map<String, String> textReplacementRules; private final String testName; private final TestMode testMode; priv...
Can you add in creating a directory client and putting a file under it? That way we show all the basic client types.
public static void main(String[] args) throws IOException { /* * From the Azure portal, get your Storage account's name and account key. */ String accountName = SampleHelper.getAccountName(); String accountKey = SampleHelper.getAccountKey(); /* * Use your Storage account's name and key to create a credential object; th...
InputStream dataStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
public static void main(String[] args) throws IOException { /* * From the Azure portal, get your Storage account's name and account key. */ String accountName = SampleHelper.getAccountName(); String accountKey = SampleHelper.getAccountKey(); /* * Use your Storage account's name and key to create a credential object; th...
class BasicExample { /** * Entry point into the basic examples for Storage datalake. * * @param args Unused. Arguments to the program. * @throws IOException If an I/O error occurs * @throws RuntimeException If the downloaded data doesn't match the uploaded data */ }
class BasicExample { /** * Entry point into the basic examples for Storage datalake. * * @param args Unused. Arguments to the program. * @throws IOException If an I/O error occurs * @throws RuntimeException If the downloaded data doesn't match the uploaded data */ }
https://github.com/Azure/azure-sdk-for-java/issues/6106
public static void main(String[] args) throws IOException { /* * From the Azure portal, get your Storage account's name and account key. */ String accountName = SampleHelper.getAccountName(); String accountKey = SampleHelper.getAccountKey(); /* * Use your Storage account's name and key to create a credential object; th...
InputStream dataStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
public static void main(String[] args) throws IOException { /* * From the Azure portal, get your Storage account's name and account key. */ String accountName = SampleHelper.getAccountName(); String accountKey = SampleHelper.getAccountKey(); /* * Use your Storage account's name and key to create a credential object; th...
class BasicExample { /** * Entry point into the basic examples for Storage datalake. * * @param args Unused. Arguments to the program. * @throws IOException If an I/O error occurs * @throws RuntimeException If the downloaded data doesn't match the uploaded data */ }
class BasicExample { /** * Entry point into the basic examples for Storage datalake. * * @param args Unused. Arguments to the program. * @throws IOException If an I/O error occurs * @throws RuntimeException If the downloaded data doesn't match the uploaded data */ }
Should this be logged at an info level as this isn't performing the operation as expected?
public void setAttribute(String key, String value, Context context) { if (ImplUtils.isNullOrEmpty(value)) { logger.info("Failed to set span attribute since value is null or empty."); return; } final Span span = getSpan(context); if (span != null) { span.setAttribute(key, AttributeValue.stringAttributeValue(value)); } e...
logger.info("Failed to set span attribute since value is null or empty.");
public void setAttribute(String key, String value, Context context) { if (CoreUtils.isNullOrEmpty(value)) { logger.warning("Failed to set span attribute since value is null or empty."); return; } final Span span = getSpan(context); if (span != null) { span.setAttribute(key, AttributeValue.stringAttributeValue(value)); ...
class OpenTelemetryTracer implements com.azure.core.util.tracing.Tracer { private static final Tracer TRACER = OpenTelemetry.getTracerFactory().get("Azure-OpenTelemetry"); static final String COMPONENT = "component"; static final String MESSAGE_BUS_DESTINATION = "message_bus.destination"; static final String PEER_ENDPO...
class OpenTelemetryTracer implements com.azure.core.util.tracing.Tracer { private static final Tracer TRACER = OpenTelemetry.getTracerFactory().get("Azure-OpenTelemetry"); static final String COMPONENT = "component"; static final String MESSAGE_BUS_DESTINATION = "message_bus.destination"; static final String PEER_ENDPO...
Is there anyway to combine these methods together, or at least have a shared helper method as most are performing a similar operation.
private Span getSpan(Context context) { final Optional<Object> spanOptional = context.getData(PARENT_SPAN_KEY); if (!spanOptional.isPresent()) { logger.warning("Failed to find span in the context."); return null; } final Object value = spanOptional.get(); if (!(value instanceof Span)) { logger.warning("Could not extrac...
if (!spanOptional.isPresent()) {
private Span getSpan(Context context) { final Object value = getOptionalObject(context, PARENT_SPAN_KEY); if (!(value instanceof Span)) { logger.warning("Could not extract span. Data in context for key {} is not of type Span.", PARENT_SPAN_KEY); return null; } return (Span) value; }
class OpenTelemetryTracer implements com.azure.core.util.tracing.Tracer { private static final Tracer TRACER = OpenTelemetry.getTracerFactory().get("Azure-OpenTelemetry"); static final String COMPONENT = "component"; static final String MESSAGE_BUS_DESTINATION = "message_bus.destination"; static final String PEER_ENDPO...
class OpenTelemetryTracer implements com.azure.core.util.tracing.Tracer { private static final Tracer TRACER = OpenTelemetry.getTracerFactory().get("Azure-OpenTelemetry"); static final String COMPONENT = "component"; static final String MESSAGE_BUS_DESTINATION = "message_bus.destination"; static final String PEER_ENDPO...
updated to use warn
public void setAttribute(String key, String value, Context context) { if (ImplUtils.isNullOrEmpty(value)) { logger.info("Failed to set span attribute since value is null or empty."); return; } final Span span = getSpan(context); if (span != null) { span.setAttribute(key, AttributeValue.stringAttributeValue(value)); } e...
logger.info("Failed to set span attribute since value is null or empty.");
public void setAttribute(String key, String value, Context context) { if (CoreUtils.isNullOrEmpty(value)) { logger.warning("Failed to set span attribute since value is null or empty."); return; } final Span span = getSpan(context); if (span != null) { span.setAttribute(key, AttributeValue.stringAttributeValue(value)); ...
class OpenTelemetryTracer implements com.azure.core.util.tracing.Tracer { private static final Tracer TRACER = OpenTelemetry.getTracerFactory().get("Azure-OpenTelemetry"); static final String COMPONENT = "component"; static final String MESSAGE_BUS_DESTINATION = "message_bus.destination"; static final String PEER_ENDPO...
class OpenTelemetryTracer implements com.azure.core.util.tracing.Tracer { private static final Tracer TRACER = OpenTelemetry.getTracerFactory().get("Azure-OpenTelemetry"); static final String COMPONENT = "component"; static final String MESSAGE_BUS_DESTINATION = "message_bus.destination"; static final String PEER_ENDPO...
Is there a need for this?
public String getVaultUrl() { return vaultUrl; }
}
public String getVaultUrl() { return vaultUrl; }
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private final String vaultUrl; private final CertificateService service; private fina...
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private final String vaultUrl; private final CertificateService service; private fina...
Once the client is built and locked to an endpoint There is no way to find out which vault url it points to. If user has multiple clients set up, this can help to figure out different vault clients. Plus, this change was standardized across all languages.
public String getVaultUrl() { return vaultUrl; }
}
public String getVaultUrl() { return vaultUrl; }
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private final String vaultUrl; private final CertificateService service; private fina...
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private final String vaultUrl; private final CertificateService service; private fina...
`getCertificateWithResponse(name, Context.NONE).getValue();`
public KeyVaultCertificateWithPolicy getCertificate(String name) { return client.getCertificate(name).block(); }
return client.getCertificate(name).block();
public KeyVaultCertificateWithPolicy getCertificate(String name) { return client.getCertificate(name).block(); }
class CertificateClient { private final CertificateAsyncClient client; /** * Creates a CertificateClient that uses {@code pipeline} to service requests * * @param client The {@link CertificateAsyncClient} that the client routes its request through. */ CertificateClient(CertificateAsyncClient client) { this.client = cli...
class CertificateClient { private final CertificateAsyncClient client; /** * Creates a CertificateClient that uses {@code pipeline} to service requests * * @param client The {@link CertificateAsyncClient} that the client routes its request through. */ CertificateClient(CertificateAsyncClient client) { this.client = cli...
`return listPropertiesOfCertificates(false, Context.NONE)` ?
public PagedIterable<CertificateProperties> listPropertiesOfCertificates() { return new PagedIterable<>(client.listPropertiesOfCertificates(false, Context.NONE)); }
return new PagedIterable<>(client.listPropertiesOfCertificates(false, Context.NONE));
public PagedIterable<CertificateProperties> listPropertiesOfCertificates() { return new PagedIterable<>(client.listPropertiesOfCertificates(false, Context.NONE)); }
class CertificateClient { private final CertificateAsyncClient client; /** * Creates a CertificateClient that uses {@code pipeline} to service requests * * @param client The {@link CertificateAsyncClient} that the client routes its request through. */ CertificateClient(CertificateAsyncClient client) { this.client = cli...
class CertificateClient { private final CertificateAsyncClient client; /** * Creates a CertificateClient that uses {@code pipeline} to service requests * * @param client The {@link CertificateAsyncClient} that the client routes its request through. */ CertificateClient(CertificateAsyncClient client) { this.client = cli...
Given that `assertInBounds` is inclusive at the boundaries should this continue to use 1 instead of 0 since 0 buffers doesn't make sense.
public ParallelTransferOptions(Integer blockSize, Integer numBuffers, ProgressReceiver progressReceiver) { if (blockSize != null) { StorageImplUtils.assertInBounds("blockSize", blockSize, 0, BlockBlobAsyncClient.MAX_STAGE_BLOCK_BYTES); } this.blockSize = blockSize; if (numBuffers != null) { StorageImplUtils.assertInBou...
StorageImplUtils.assertInBounds("blockSize", blockSize, 0, BlockBlobAsyncClient.MAX_STAGE_BLOCK_BYTES);
public ParallelTransferOptions(Integer blockSize, Integer numBuffers, ProgressReceiver progressReceiver) { if (blockSize != null) { StorageImplUtils.assertInBounds("blockSize", blockSize, 1, BlockBlobAsyncClient.MAX_STAGE_BLOCK_BYTES); } this.blockSize = blockSize; if (numBuffers != null) { StorageImplUtils.assertInBou...
class ParallelTransferOptions { private final Integer blockSize; private final Integer numBuffers; private final ProgressReceiver progressReceiver; /** * Creates a new {@link ParallelTransferOptions} with default parameters applied. * * @param blockSize The block size. * For upload, The block size is the size of each b...
class ParallelTransferOptions { private final Integer blockSize; private final Integer numBuffers; private final ProgressReceiver progressReceiver; /** * Creates a new {@link ParallelTransferOptions} with default parameters applied. * * @param blockSize The block size. * For upload, The block size is the size of each b...
This is a safeguard in case the operation fails and the user won't have a potentially corrupted file, correct? If so, would we want to log a message here stating that the operation wasn't able to successfully complete, cleaning up resources.
private void downloadToFileCleanup(AsynchronousFileChannel channel, String filePath, SignalType signalType) { try { channel.close(); if (!signalType.equals(SignalType.ON_COMPLETE)) { Files.delete(Paths.get(filePath)); } } catch (IOException e) { throw logger.logExceptionAsError(new UncheckedIOException(e)); } }
if (!signalType.equals(SignalType.ON_COMPLETE)) {
private void downloadToFileCleanup(AsynchronousFileChannel channel, String filePath, SignalType signalType) { try { channel.close(); if (!signalType.equals(SignalType.ON_COMPLETE)) { Files.delete(Paths.get(filePath)); logger.verbose("Downloading to file failed. Cleaning up resources."); } } catch (IOException e) { thro...
class BlobAsyncClientBase { private static final int BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE = 4 * Constants.MB; private static final int BLOB_MAX_DOWNLOAD_BLOCK_SIZE = 100 * Constants.MB; private final ClientLogger logger = new ClientLogger(BlobAsyncClientBase.class); protected final AzureBlobStorageImpl azureBlobStorage; pr...
class BlobAsyncClientBase { private static final int BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE = 4 * Constants.MB; private static final int BLOB_MAX_DOWNLOAD_BLOCK_SIZE = 100 * Constants.MB; private final ClientLogger logger = new ClientLogger(BlobAsyncClientBase.class); protected final AzureBlobStorageImpl azureBlobStorage; pr...
nit: this could be slightly less verbose by making this method return just BlobProperties and only accept the headers as an argument. and wherever you call it you can essentially just say new SimpleResponse<>(response, buildBlobProperties(response.getDeserializedHeaders()));
private static Response<BlobProperties> buildBlobPropertiesResponse(BlobDownloadAsyncResponse response) { BlobProperties properties = new BlobProperties(null, response.getDeserializedHeaders().getLastModified(), response.getDeserializedHeaders().getETag(), response.getDeserializedHeaders().getContentLength() == null ? ...
BlobProperties properties = new BlobProperties(null, response.getDeserializedHeaders().getLastModified(),
private static Response<BlobProperties> buildBlobPropertiesResponse(BlobDownloadAsyncResponse response) { BlobProperties properties = new BlobProperties(null, response.getDeserializedHeaders().getLastModified(), response.getDeserializedHeaders().getETag(), response.getDeserializedHeaders().getContentLength() == null ? ...
class BlobAsyncClientBase { private static final int BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE = 4 * Constants.MB; private static final int BLOB_MAX_DOWNLOAD_BLOCK_SIZE = 100 * Constants.MB; private final ClientLogger logger = new ClientLogger(BlobAsyncClientBase.class); protected final AzureBlobStorageImpl azureBlobStorage; pr...
class BlobAsyncClientBase { private static final int BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE = 4 * Constants.MB; private static final int BLOB_MAX_DOWNLOAD_BLOCK_SIZE = 100 * Constants.MB; private final ClientLogger logger = new ClientLogger(BlobAsyncClientBase.class); protected final AzureBlobStorageImpl azureBlobStorage; pr...
I only ever call this once. It's just to hide this ugly constructor block. I think it's more concise constructing the response in the method cus then I can hide the response construction, too.
private static Response<BlobProperties> buildBlobPropertiesResponse(BlobDownloadAsyncResponse response) { BlobProperties properties = new BlobProperties(null, response.getDeserializedHeaders().getLastModified(), response.getDeserializedHeaders().getETag(), response.getDeserializedHeaders().getContentLength() == null ? ...
BlobProperties properties = new BlobProperties(null, response.getDeserializedHeaders().getLastModified(),
private static Response<BlobProperties> buildBlobPropertiesResponse(BlobDownloadAsyncResponse response) { BlobProperties properties = new BlobProperties(null, response.getDeserializedHeaders().getLastModified(), response.getDeserializedHeaders().getETag(), response.getDeserializedHeaders().getContentLength() == null ? ...
class BlobAsyncClientBase { private static final int BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE = 4 * Constants.MB; private static final int BLOB_MAX_DOWNLOAD_BLOCK_SIZE = 100 * Constants.MB; private final ClientLogger logger = new ClientLogger(BlobAsyncClientBase.class); protected final AzureBlobStorageImpl azureBlobStorage; pr...
class BlobAsyncClientBase { private static final int BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE = 4 * Constants.MB; private static final int BLOB_MAX_DOWNLOAD_BLOCK_SIZE = 100 * Constants.MB; private final ClientLogger logger = new ClientLogger(BlobAsyncClientBase.class); protected final AzureBlobStorageImpl azureBlobStorage; pr...
please change to this. ```java long maxGlobalCommittedLsn = (responses != null) ? (Long) responses.stream().map(s -> s.globalCommittedLSN).max(ComparatorUtils.NATURAL_COMPARATOR).orElse(0L) : 0L; ```
private Mono<Boolean> waitForWriteBarrierAsync(RxDocumentServiceRequest barrierRequest, long selectedGlobalCommittedLsn) { AtomicInteger writeBarrierRetryCount = new AtomicInteger(ConsistencyWriter.MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES); AtomicLong maxGlobalCommittedLsnReceived = new AtomicLong(0); return Flux.defer...
long maxGlobalCommittedLsn = (responses != null && !responses.isEmpty()) ?
private Mono<Boolean> waitForWriteBarrierAsync(RxDocumentServiceRequest barrierRequest, long selectedGlobalCommittedLsn) { AtomicInteger writeBarrierRetryCount = new AtomicInteger(ConsistencyWriter.MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES); AtomicLong maxGlobalCommittedLsnReceived = new AtomicLong(0); return Flux.defer...
class ConsistencyWriter { private final static int MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES = 30; private final static int DELAY_BETWEEN_WRITE_BARRIER_CALLS_IN_MS = 30; private final static int MAX_SHORT_BARRIER_RETRIES_FOR_MULTI_REGION = 4; private final static int SHORT_BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION =...
class ConsistencyWriter { private final static int MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES = 30; private final static int DELAY_BETWEEN_WRITE_BARRIER_CALLS_IN_MS = 30; private final static int MAX_SHORT_BARRIER_RETRIES_FOR_MULTI_REGION = 4; private final static int SHORT_BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION =...
Fixed
private Mono<Boolean> waitForWriteBarrierAsync(RxDocumentServiceRequest barrierRequest, long selectedGlobalCommittedLsn) { AtomicInteger writeBarrierRetryCount = new AtomicInteger(ConsistencyWriter.MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES); AtomicLong maxGlobalCommittedLsnReceived = new AtomicLong(0); return Flux.defer...
long maxGlobalCommittedLsn = (responses != null && !responses.isEmpty()) ?
private Mono<Boolean> waitForWriteBarrierAsync(RxDocumentServiceRequest barrierRequest, long selectedGlobalCommittedLsn) { AtomicInteger writeBarrierRetryCount = new AtomicInteger(ConsistencyWriter.MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES); AtomicLong maxGlobalCommittedLsnReceived = new AtomicLong(0); return Flux.defer...
class ConsistencyWriter { private final static int MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES = 30; private final static int DELAY_BETWEEN_WRITE_BARRIER_CALLS_IN_MS = 30; private final static int MAX_SHORT_BARRIER_RETRIES_FOR_MULTI_REGION = 4; private final static int SHORT_BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION =...
class ConsistencyWriter { private final static int MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES = 30; private final static int DELAY_BETWEEN_WRITE_BARRIER_CALLS_IN_MS = 30; private final static int MAX_SHORT_BARRIER_RETRIES_FOR_MULTI_REGION = 4; private final static int SHORT_BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION =...
I think the toUrl method may also need to be updated. It looks like it always sets the container right after the host and never considers if it needs to set the account name?
public static BlobUrlParts parse(URL url) { BlobUrlParts parts = new BlobUrlParts().setScheme(url.getProtocol()); if (ModelHelper.IP_V4_URL_PATTERN.matcher(url.getHost()).find()) { parseIpUrl(url, parts); } else { parseNonIpUrl(url, parts); } Map<String, String[]> queryParamsMap = parseQueryString(url.getQuery()); Stri...
if (ModelHelper.IP_V4_URL_PATTERN.matcher(url.getHost()).find()) {
public static BlobUrlParts parse(URL url) { BlobUrlParts parts = new BlobUrlParts().setScheme(url.getProtocol()); if (ModelHelper.IP_V4_URL_PATTERN.matcher(url.getHost()).find()) { parseIpUrl(url, parts); } else { parseNonIpUrl(url, parts); } Map<String, String[]> queryParamsMap = parseQueryString(url.getQuery()); Stri...
class BlobUrlParts { private final ClientLogger logger = new ClientLogger(BlobUrlParts.class); private String scheme; private String host; private String containerName; private String blobName; private String snapshot; private String accountName; private BlobServiceSasQueryParameters blobServiceSasQueryParameters; priv...
class BlobUrlParts { private final ClientLogger logger = new ClientLogger(BlobUrlParts.class); private String scheme; private String host; private String containerName; private String blobName; private String snapshot; private String accountName; private boolean isIpUrl; private BlobServiceSasQueryParameters blobServic...
Updated
public static BlobUrlParts parse(URL url) { BlobUrlParts parts = new BlobUrlParts().setScheme(url.getProtocol()); if (ModelHelper.IP_V4_URL_PATTERN.matcher(url.getHost()).find()) { parseIpUrl(url, parts); } else { parseNonIpUrl(url, parts); } Map<String, String[]> queryParamsMap = parseQueryString(url.getQuery()); Stri...
if (ModelHelper.IP_V4_URL_PATTERN.matcher(url.getHost()).find()) {
public static BlobUrlParts parse(URL url) { BlobUrlParts parts = new BlobUrlParts().setScheme(url.getProtocol()); if (ModelHelper.IP_V4_URL_PATTERN.matcher(url.getHost()).find()) { parseIpUrl(url, parts); } else { parseNonIpUrl(url, parts); } Map<String, String[]> queryParamsMap = parseQueryString(url.getQuery()); Stri...
class BlobUrlParts { private final ClientLogger logger = new ClientLogger(BlobUrlParts.class); private String scheme; private String host; private String containerName; private String blobName; private String snapshot; private String accountName; private BlobServiceSasQueryParameters blobServiceSasQueryParameters; priv...
class BlobUrlParts { private final ClientLogger logger = new ClientLogger(BlobUrlParts.class); private String scheme; private String host; private String containerName; private String blobName; private String snapshot; private String accountName; private boolean isIpUrl; private BlobServiceSasQueryParameters blobServic...
Collections.singletonList already returns a list. Why are you wrapping it in another ArrayList?
static DocumentResultCollection<DetectLanguageResult> getExpectedBatchDetectedLanguages() { DetectedLanguage detectedLanguage1 = new DetectedLanguage().setName("English").setIso6391Name("en") .setScore(1.0); DetectedLanguage detectedLanguage2 = new DetectedLanguage().setName("Spanish").setIso6391Name("es") .setScore(1....
List<DetectedLanguage> detectedLanguageList1 = new ArrayList<>(Collections.singletonList(detectedLanguage1));
static DocumentResultCollection<DetectLanguageResult> getExpectedBatchDetectedLanguages() { DetectedLanguage detectedLanguage1 = new DetectedLanguage("English", "en", 1.0); DetectedLanguage detectedLanguage2 = new DetectedLanguage("Spanish", "es", 1.0); DetectedLanguage detectedLanguage3 = new DetectedLanguage("(Unknow...
class TextAnalyticsClientTestBase extends TestBase { private static final String TEXT_ANALYTICS_PROPERTIES = "azure-textanalytics.properties"; private static final String NAME = "name"; private static final String VERSION = "version"; private static final String DEFAULT_SCOPE = "https: final Map<String, String> propert...
class TextAnalyticsClientTestBase extends TestBase { private static final String TEXT_ANALYTICS_PROPERTIES = "azure-ai-textanalytics.properties"; private static final String NAME = "name"; private static final String VERSION = "version"; private static final String DEFAULT_SCOPE = "https: private final Map<String, Stri...
Since you're doing a switch-case on this arbitrary string "Language" down in validateDocuments, you should make this either a constant string that is shared by all your test cases, or an enum.
public void detectLanguagesBatchInputShowStatistics() { detectLanguageShowStatisticsRunner((inputs, options) -> { StepVerifier.create(client.detectBatchLanguagesWithResponse(inputs, options)) .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchDetectedLanguages(), "Language")) .verifyComple...
.assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchDetectedLanguages(), "Language"))
public void detectLanguagesBatchInputShowStatistics() { detectLanguageShowStatisticsRunner((inputs, options) -> { StepVerifier.create(client.detectBatchLanguagesWithResponse(inputs, options)) .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchDetectedLanguages(), TestEndpoint.LANGUAGE)) .v...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @Override protected void beforeTest() { client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() .endpoint(getEndPoint()) .pipeline(httpPipeline) .buildAsyncClient()); } /** * Verify that we ca...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @Override protected void beforeTest() { client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() .endpoint(getEndpoint()) .pipeline(httpPipeline) .buildAsyncClient()); } /** * Verify that we ca...
If we write "language", the switch-case no longer passes.
public void detectLanguagesBatchInputShowStatistics() { detectLanguageShowStatisticsRunner((inputs, options) -> { StepVerifier.create(client.detectBatchLanguagesWithResponse(inputs, options)) .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchDetectedLanguages(), "Language")) .verifyComple...
.assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchDetectedLanguages(), "Language"))
public void detectLanguagesBatchInputShowStatistics() { detectLanguageShowStatisticsRunner((inputs, options) -> { StepVerifier.create(client.detectBatchLanguagesWithResponse(inputs, options)) .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchDetectedLanguages(), TestEndpoint.LANGUAGE)) .v...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @Override protected void beforeTest() { client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() .endpoint(getEndPoint()) .pipeline(httpPipeline) .buildAsyncClient()); } /** * Verify that we ca...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @Override protected void beforeTest() { client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() .endpoint(getEndpoint()) .pipeline(httpPipeline) .buildAsyncClient()); } /** * Verify that we ca...
Why is this wrapped in an ArrayList? same in the one below.
static void detectLanguagesCountryHintRunner(BiConsumer<List<String>, String> testRunner) { final List<String> inputs = new ArrayList<>(Arrays.asList( "This is written in English", "Este es un document escrito en Español.", "~@!~:)")); testRunner.accept(inputs, "US"); }
final List<String> inputs = new ArrayList<>(Arrays.asList(
static void detectLanguagesCountryHintRunner(BiConsumer<List<String>, String> testRunner) { final List<String> inputs = Arrays.asList( "This is written in English", "Este es un document escrito en Español.", "~@!~:)"); testRunner.accept(inputs, "en"); }
class TextAnalyticsClientTestBase extends TestBase { private static final String TEXT_ANALYTICS_PROPERTIES = "azure-textanalytics.properties"; private static final String NAME = "name"; private static final String VERSION = "version"; private static final String DEFAULT_SCOPE = "https: final Map<String, String> propert...
class TextAnalyticsClientTestBase extends TestBase { private static final String TEXT_ANALYTICS_PROPERTIES = "azure-ai-textanalytics.properties"; private static final String NAME = "name"; private static final String VERSION = "version"; private static final String DEFAULT_SCOPE = "https: private final Map<String, Stri...
`new ArrayList<>(Arrays.asList(` should just be `Arrays.asList(`. you may have to do a Ctrl F and replace all.
public void detectSingleTextLanguage() { DetectedLanguage primaryLanguage = new DetectedLanguage().setName("English").setIso6391Name("en").setScore(1.0); List<DetectedLanguage> expectedLanguageList = new ArrayList<>(Arrays.asList(primaryLanguage)); StepVerifier.create(client.detectLanguage("This is a test English Text"...
List<DetectedLanguage> expectedLanguageList = new ArrayList<>(Arrays.asList(primaryLanguage));
public void detectSingleTextLanguage() { DetectedLanguage primaryLanguage = new DetectedLanguage("English", "en", 1.0); List<DetectedLanguage> expectedLanguageList = Arrays.asList(primaryLanguage); StepVerifier.create(client.detectLanguage("This is a test English Text")) .assertNext(response -> validateDetectedLanguage...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @Override protected void beforeTest() { client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() .endpoint(getEndPoint()) .pipeline(httpPipeline) .buildAsyncClient()); } /** * Verify that we ca...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @Override protected void beforeTest() { client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() .endpoint(getEndpoint()) .pipeline(httpPipeline) .buildAsyncClient()); } /** * Verify that we ca...
`%n` should be used.
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_SUBSCRIPTION_KEY")) .endpoint(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_ENDPOINT")) .buildClient(); List<TextDoc...
System.out.printf("Recognized Linked NamedEntity: %s, URL: %s, Data Source: %s",
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("subscription-key") .endpoint("https: .buildClient(); List<TextDocumentInput> inputs = Arrays.asList( new TextDocumentInput("1", "Old Faithful is a geyser at Yellowstone Park.", "en"), new TextDocumen...
class RecognizeLinkedEntitiesBatchDocuments { }
class RecognizeLinkedEntitiesBatchDocuments { /** * Main method to invoke this demo about how to recognize linked entities of a batch of text inputs. * * @param args Unused arguments to the program. */ }
Same comment as below. you can use a foreach loop.
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_SUBSCRIPTION_KEY")) .endpoint(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_ENDPOINT")) .buildClient(); List<TextDoc...
detectedBatchResult.forEach(detectedEntityResult ->
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("subscription-key") .endpoint("https: .buildClient(); List<TextDocumentInput> inputs = Arrays.asList( new TextDocumentInput("1", "Satya Nadella is the CEO of Microsoft.", "en"), new TextDocumentInput(...
class RecognizeEntitiesBatchDocuments { }
class RecognizeEntitiesBatchDocuments { /** * Main method to invoke this demo about how to recognize entities of a batch of text inputs. * * @param args Unused arguments to the program. */ }
add `%n`
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_SUBSCRIPTION_KEY")) .endpoint(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_ENDPOINT")) .buildClient(); String text ...
"Recognized NamedEntity: %s, NamedEntity Type: %s, NamedEntity Subtype: %s, Offset: %s, Length: %s, Score: %s",
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("subscription-key") .endpoint("https: .buildClient(); String text = "Satya Nadella is the CEO of Microsoft"; for (NamedEntity entity : client.recognizeEntities(text).getNamedEntities()) { System.out.p...
class RecognizeEntities { }
class RecognizeEntities { /** * Main method to invoke this demo about how to recognize entities of a text input. * * @param args Unused arguments to the program. */ }
add `%n`
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_SUBSCRIPTION_KEY")) .endpoint(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_ENDPOINT")) .buildClient(); String text ...
"Recognized TextSentiment: %s, Positive Score: %s, Neutral Score: %s, Negative Score: %s.",
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("subscription-key") .endpoint("https: .buildClient(); String text = "The hotel was dark and unclean."; final AnalyzeSentimentResult sentimentResult = client.analyzeSentiment(text); final TextSentiment...
class AnalyzeSentiment { }
class AnalyzeSentiment { /** * Main method to invoke this demo about how to analyze sentiment of a text input. * * @param args Unused arguments to the program. */ }
add `%n`
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_SUBSCRIPTION_KEY")) .endpoint(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_ENDPOINT")) .buildClient(); String text ...
"Recognized Sentence TextSentiment: %s, Positive Score: %s, Neutral Score: %s, Negative Score: %s.",
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("subscription-key") .endpoint("https: .buildClient(); String text = "The hotel was dark and unclean."; final AnalyzeSentimentResult sentimentResult = client.analyzeSentiment(text); final TextSentiment...
class AnalyzeSentiment { }
class AnalyzeSentiment { /** * Main method to invoke this demo about how to analyze sentiment of a text input. * * @param args Unused arguments to the program. */ }
This should be cleaned up in your samples, since you have the invocation of .subscriptionKey and .endpoint twice.
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_SUBSCRIPTION_KEY")) .endpoint(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_ENDPOINT")) .buildClient(); String text ...
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("subscription-key") .endpoint("https: .buildClient(); String text = "hello world"; final DetectLanguageResult detectLanguageResult = client.detectLanguage(text, "US"); final DetectedLanguage detectedD...
class HelloWorld { }
class HelloWorld { /** * Main method to invoke this demo about how to detect language of a text input. * * @param args Unused arguments to the program. */ }
I don't think you need a local variable declaration for this. ``` for (DetectedLanguage language : detectLanguageResult.getDetectedLanguages()) { ... ``` or ``` detectLanguageResult.getDetectedLanguages().foreach(language -> { }); ```
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_SUBSCRIPTION_KEY")) .endpoint(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_ENDPOINT")) .buildClient(); String text ...
final List<DetectedLanguage> detectedLanguages = detectLanguageResult.getDetectedLanguages();
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("subscription-key") .endpoint("https: .buildClient(); String text = "hello world"; final DetectLanguageResult detectLanguageResult = client.detectLanguage(text, "US"); final DetectedLanguage detectedD...
class HelloWorld { }
class HelloWorld { /** * Main method to invoke this demo about how to detect language of a text input. * * @param args Unused arguments to the program. */ }
Wrap this with try-catch and return Mono.error() if there are any exceptions. For reference, see other async clients.
public Mono<DetectLanguageResult> detectLanguage(String text) { return detectLanguageWithResponse(text, defaultCountryHint).flatMap(FluxUtil::toMono); }
return detectLanguageWithResponse(text, defaultCountryHint).flatMap(FluxUtil::toMono);
public Mono<DetectLanguageResult> detectLanguage(String text) { try { return detectLanguageWithResponse(text, defaultCountryHint).flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); } }
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; /** * Create a {@...
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; /** * Create a {@...
Could we move these getters up with `getServiceVersion`? It's easier to find getters if they are grouped together.
public String getDefaultLanguage() { return defaultLanguage; }
}
public String getDefaultLanguage() { return defaultLanguage; }
class (Positive, Negative, and * Neutral) for the document and each sentence within it. * * @param textInputs A list of {@link TextDocumentInput inputs/documents}
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; /** * Create a {@...
This would only happen if the service returned an invalid Sentiment type correct? Is this a good spot to throw a Runtime exception if the service failed? Maybe skip the result, log a warning, and continue processing the other responses.
private AnalyzeSentimentResult convertToTextSentimentResult(final DocumentSentiment documentSentiment) { final TextSentimentClass documentSentimentClass = TextSentimentClass.fromString(documentSentiment. getSentiment().toString()); if (documentSentimentClass == null) { throw logger.logExceptionAsWarning( new RuntimeExc...
if (documentSentimentClass == null) {
private AnalyzeSentimentResult convertToTextSentimentResult(final DocumentSentiment documentSentiment) { final TextSentimentClass documentSentimentClass = TextSentimentClass.fromString(documentSentiment. getSentiment().toString()); if (documentSentimentClass == null) { logger.logExceptionAsWarning( new RuntimeException...
class (Positive, Negative, and * Neutral) for the document and each sentence within it. * * @param textInputs A list of {@link TextDocumentInput inputs/documents}
class (Positive, Negative, and * Neutral) for the document and each sentence within it. * * @param textInputs A list of {@link TextDocumentInput inputs/documents}
Same as my other comment around this being a service issue.
private AnalyzeSentimentResult convertToTextSentimentResult(final DocumentSentiment documentSentiment) { final TextSentimentClass documentSentimentClass = TextSentimentClass.fromString(documentSentiment. getSentiment().toString()); if (documentSentimentClass == null) { throw logger.logExceptionAsWarning( new RuntimeExc...
throw logger.logExceptionAsWarning(
private AnalyzeSentimentResult convertToTextSentimentResult(final DocumentSentiment documentSentiment) { final TextSentimentClass documentSentimentClass = TextSentimentClass.fromString(documentSentiment. getSentiment().toString()); if (documentSentimentClass == null) { logger.logExceptionAsWarning( new RuntimeException...
class (Positive, Negative, and * Neutral) for the document and each sentence within it. * * @param textInputs A list of {@link TextDocumentInput inputs/documents}
class (Positive, Negative, and * Neutral) for the document and each sentence within it. * * @param textInputs A list of {@link TextDocumentInput inputs/documents}
retryAfterHeader : This could be null when user do not want to use any response header for retry.
private Duration determineDelayDuration(HttpResponse response, int tryCount) { int code = response.getStatusCode(); if (code != 429 && code != 503) { return retryStrategy.calculateRetryDelay(tryCount); } String retryHeaderValue = null; if (!isNullOrEmpty(retryAfterHeader)) { retryHeaderValue = response.getHeaderValue(r...
retryHeaderValue = response.getHeaderValue(retryAfterHeader);
private Duration determineDelayDuration(HttpResponse response, int tryCount) { int code = response.getStatusCode(); if (code != 429 && code != 503) { return retryPolicyOptions.getRetryStrategy().calculateRetryDelay(tryCount); } String retryHeaderValue = null; if (!isNullOrEmpty(retryPolicyOptions.getRetryAfterHeader())...
class RetryPolicy implements HttpPipelinePolicy { private final ClientLogger logger = new ClientLogger(RetryPolicy.class); private final RetryStrategy retryStrategy; private final String retryAfterHeader; private final ChronoUnit retryAfterTimeUnit; /** * Creates a default {@link ExponentialBackoff} retry policy. */ pu...
class RetryPolicy implements HttpPipelinePolicy { private final ClientLogger logger = new ClientLogger(RetryPolicy.class); private final RetryPolicyOptions retryPolicyOptions; /** * Creates {@link RetryPolicy} with default {@link ExponentialBackoff} as {@link RetryStrategy}and use * 'retry-after-ms' in {@link HttpRespo...
Let's just instantiate with `this.retryStrategy = new ExponentialBackoff()`
public RetryPolicyOptions() { setRetryOptions(new ExponentialBackoff(), null, null); }
setRetryOptions(new ExponentialBackoff(), null, null);
public RetryPolicyOptions() { this(new ExponentialBackoff(), null, null); }
class RetryPolicyOptions { private RetryStrategy retryStrategy; private String retryAfterHeader; private ChronoUnit retryAfterTimeUnit; /** * Creates a default {@link ExponentialBackoff} for retry policy. It will not use any {@code retryAfterHeader} * in {@link HttpResponse}. */ /** * Sets RetryPolicyOptions with the p...
class RetryPolicyOptions { private final RetryStrategy retryStrategy; private final String retryAfterHeader; private final ChronoUnit retryAfterTimeUnit; /** * Creates a default {@link RetryPolicyOptions} used by a {@link RetryPolicy}. This will use * {@link ExponentialBackoff} as the {@link */ /** * Creates the {@link...
This should also check that `retryPolicyOptions.getRetryStrategy()` is also non-null. We need that to be set.
public RetryPolicy(RetryPolicyOptions retryPolicyOptions) { this.retryPolicyOptions = Objects.requireNonNull(retryPolicyOptions, "'retryPolicyOptions' cannot be null."); }
this.retryPolicyOptions = Objects.requireNonNull(retryPolicyOptions,
public RetryPolicy(RetryPolicyOptions retryPolicyOptions) { this.retryPolicyOptions = Objects.requireNonNull(retryPolicyOptions, "'retryPolicyOptions' cannot be null."); Objects.requireNonNull(retryPolicyOptions.getRetryStrategy(), "'retryPolicyOptions.retryStrategy' cannot be null."); }
class RetryPolicy implements HttpPipelinePolicy { private final ClientLogger logger = new ClientLogger(RetryPolicy.class); private final RetryPolicyOptions retryPolicyOptions; /** * Creates a default {@link RetryPolicy} with default {@link RetryPolicyOptions}. */ public RetryPolicy() { this(new RetryPolicyOptions()); }...
class RetryPolicy implements HttpPipelinePolicy { private final ClientLogger logger = new ClientLogger(RetryPolicy.class); private final RetryPolicyOptions retryPolicyOptions; /** * Creates {@link RetryPolicy} with default {@link ExponentialBackoff} as {@link RetryStrategy}and use * 'retry-after-ms' in {@link HttpRespo...
I don't think the default should use `retry-after-ms` for the header, as far as I know this is only used by AppConfiguration.
public RetryPolicy() { this(new RetryPolicyOptions(new ExponentialBackoff(), RETRY_AFTER_MS_HEADER, ChronoUnit.MILLIS)); }
this(new RetryPolicyOptions(new ExponentialBackoff(), RETRY_AFTER_MS_HEADER, ChronoUnit.MILLIS));
public RetryPolicy() { this(new RetryPolicyOptions(new ExponentialBackoff())); }
class RetryPolicy implements HttpPipelinePolicy { private final ClientLogger logger = new ClientLogger(RetryPolicy.class); private static final String RETRY_AFTER_MS_HEADER = "retry-after-ms"; private final RetryPolicyOptions retryPolicyOptions; /** * Creates {@link RetryPolicy} with default {@link ExponentialBackoff} ...
class RetryPolicy implements HttpPipelinePolicy { private final ClientLogger logger = new ClientLogger(RetryPolicy.class); private final RetryPolicyOptions retryPolicyOptions; /** * Creates {@link RetryPolicy} with default {@link ExponentialBackoff} as {@link RetryStrategy}and use * 'retry-after-ms' in {@link HttpRespo...
Should this be using `requireNonNull` or just use `ExponentialBackoff` if it is null?
public RetryPolicyOptions(RetryStrategy retryStrategy, String retryAfterHeader, ChronoUnit retryAfterTimeUnit) { this.retryStrategy = Objects.requireNonNull(retryStrategy, "'retryStrategy' cannot be null."); this.retryAfterHeader = retryAfterHeader; this.retryAfterTimeUnit = retryAfterTimeUnit; if (!isNullOrEmpty(retry...
this.retryStrategy = Objects.requireNonNull(retryStrategy, "'retryStrategy' cannot be null.");
public RetryPolicyOptions(RetryStrategy retryStrategy, String retryAfterHeader, ChronoUnit retryAfterTimeUnit) { if (Objects.isNull(retryStrategy)) { this.retryStrategy = new ExponentialBackoff(); } else { this.retryStrategy = retryStrategy; } this.retryAfterHeader = retryAfterHeader; this.retryAfterTimeUnit = retryAft...
class RetryPolicyOptions { private final RetryStrategy retryStrategy; private final String retryAfterHeader; private final ChronoUnit retryAfterTimeUnit; /** * Creates a default {@link RetryPolicyOptions} used by a {@link RetryPolicy}. This will use * {@link ExponentialBackoff} as the {@link */ public RetryPolicyOption...
class RetryPolicyOptions { private final RetryStrategy retryStrategy; private final String retryAfterHeader; private final ChronoUnit retryAfterTimeUnit; /** * Creates a default {@link RetryPolicyOptions} used by a {@link RetryPolicy}. This will use * {@link ExponentialBackoff} as the {@link */ public RetryPolicyOption...
will use use ExponentialBackoff
public RetryPolicyOptions(RetryStrategy retryStrategy, String retryAfterHeader, ChronoUnit retryAfterTimeUnit) { this.retryStrategy = Objects.requireNonNull(retryStrategy, "'retryStrategy' cannot be null."); this.retryAfterHeader = retryAfterHeader; this.retryAfterTimeUnit = retryAfterTimeUnit; if (!isNullOrEmpty(retry...
this.retryStrategy = Objects.requireNonNull(retryStrategy, "'retryStrategy' cannot be null.");
public RetryPolicyOptions(RetryStrategy retryStrategy, String retryAfterHeader, ChronoUnit retryAfterTimeUnit) { if (Objects.isNull(retryStrategy)) { this.retryStrategy = new ExponentialBackoff(); } else { this.retryStrategy = retryStrategy; } this.retryAfterHeader = retryAfterHeader; this.retryAfterTimeUnit = retryAft...
class RetryPolicyOptions { private final RetryStrategy retryStrategy; private final String retryAfterHeader; private final ChronoUnit retryAfterTimeUnit; /** * Creates a default {@link RetryPolicyOptions} used by a {@link RetryPolicy}. This will use * {@link ExponentialBackoff} as the {@link */ public RetryPolicyOption...
class RetryPolicyOptions { private final RetryStrategy retryStrategy; private final String retryAfterHeader; private final ChronoUnit retryAfterTimeUnit; /** * Creates a default {@link RetryPolicyOptions} used by a {@link RetryPolicy}. This will use * {@link ExponentialBackoff} as the {@link */ public RetryPolicyOption...
Updated AppConfiguration with this header
public RetryPolicy() { this(new RetryPolicyOptions(new ExponentialBackoff(), RETRY_AFTER_MS_HEADER, ChronoUnit.MILLIS)); }
this(new RetryPolicyOptions(new ExponentialBackoff(), RETRY_AFTER_MS_HEADER, ChronoUnit.MILLIS));
public RetryPolicy() { this(new RetryPolicyOptions(new ExponentialBackoff())); }
class RetryPolicy implements HttpPipelinePolicy { private final ClientLogger logger = new ClientLogger(RetryPolicy.class); private static final String RETRY_AFTER_MS_HEADER = "retry-after-ms"; private final RetryPolicyOptions retryPolicyOptions; /** * Creates {@link RetryPolicy} with default {@link ExponentialBackoff} ...
class RetryPolicy implements HttpPipelinePolicy { private final ClientLogger logger = new ClientLogger(RetryPolicy.class); private final RetryPolicyOptions retryPolicyOptions; /** * Creates {@link RetryPolicy} with default {@link ExponentialBackoff} as {@link RetryStrategy}and use * 'retry-after-ms' in {@link HttpRespo...
nit: this is an odd line break. Would expect it to be before `&&`.
private boolean shouldRetry(HttpResponse response, int tryCount) { return tryCount < retryPolicyOptions.getRetryStrategy().getMaxRetries() && retryPolicyOptions.getRetryStrategy() .shouldRetry(response); }
return tryCount < retryPolicyOptions.getRetryStrategy().getMaxRetries() && retryPolicyOptions.getRetryStrategy()
private boolean shouldRetry(HttpResponse response, int tryCount) { return tryCount < retryPolicyOptions.getRetryStrategy().getMaxRetries() && retryPolicyOptions.getRetryStrategy().shouldRetry(response); }
class RetryPolicy implements HttpPipelinePolicy { private final ClientLogger logger = new ClientLogger(RetryPolicy.class); private final RetryPolicyOptions retryPolicyOptions; /** * Creates {@link RetryPolicy} with default {@link ExponentialBackoff} as {@link RetryStrategy}and use * 'retry-after-ms' in {@link HttpRespo...
class RetryPolicy implements HttpPipelinePolicy { private final ClientLogger logger = new ClientLogger(RetryPolicy.class); private final RetryPolicyOptions retryPolicyOptions; /** * Creates {@link RetryPolicy} with default {@link ExponentialBackoff} as {@link RetryStrategy}and use * 'retry-after-ms' in {@link HttpRespo...
Since RetryPolicyOptions is immutable, to save allocations, I'd have a default RetryPolicyOptions that is static and immutable.
public ConfigurationAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration().clone() : configuration; ConfigurationClientCredentials configurationCredentials = getConfigurationCredentials(buildConfiguration); String buildEndpoint = getBuildEndp...
policies.add(retryPolicy == null ? new RetryPolicy( new RetryPolicyOptions(new ExponentialBackoff(),
public ConfigurationAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration().clone() : configuration; ConfigurationClientCredentials configurationCredentials = getConfigurationCredentials(buildConfiguration); String buildEndpoint = getBuildEndp...
class ConfigurationClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER = "Content-Type"; private static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private static final String ACCEPT_HEADER = "Accept"; pri...
class ConfigurationClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER = "Content-Type"; private static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private static final String ACCEPT_HEADER = "Accept"; pri...
`logger` will never be `null`. Don't need the null check here.
private boolean canLogAtLevel(int logLevel, int environmentLoggingLevel) { if (logLevel < environmentLoggingLevel || logger == null) { return false; } switch (logLevel) { case VERBOSE_LEVEL: return logger.isDebugEnabled(); case INFORMATIONAL_LEVEL: return logger.isInfoEnabled(); case WARNING_LEVEL: return logger.isWarn...
if (logLevel < environmentLoggingLevel || logger == null) {
private boolean canLogAtLevel(int logLevel, int environmentLoggingLevel) { if (logLevel < environmentLoggingLevel) { return false; } switch (logLevel) { case VERBOSE_LEVEL: return logger.isDebugEnabled(); case INFORMATIONAL_LEVEL: return logger.isInfoEnabled(); case WARNING_LEVEL: return logger.isWarnEnabled(); case ER...
class name using the {@link LoggerFactory}
class name using the {@link LoggerFactory}
This may have been done in the past for SpotBugs, will investigate.
private boolean canLogAtLevel(int logLevel, int environmentLoggingLevel) { if (logLevel < environmentLoggingLevel || logger == null) { return false; } switch (logLevel) { case VERBOSE_LEVEL: return logger.isDebugEnabled(); case INFORMATIONAL_LEVEL: return logger.isInfoEnabled(); case WARNING_LEVEL: return logger.isWarn...
if (logLevel < environmentLoggingLevel || logger == null) {
private boolean canLogAtLevel(int logLevel, int environmentLoggingLevel) { if (logLevel < environmentLoggingLevel) { return false; } switch (logLevel) { case VERBOSE_LEVEL: return logger.isDebugEnabled(); case INFORMATIONAL_LEVEL: return logger.isInfoEnabled(); case WARNING_LEVEL: return logger.isWarnEnabled(); case ER...
class name using the {@link LoggerFactory}
class name using the {@link LoggerFactory}
I think the logic here could be simplified, right now this is going to perform the same check multiple times. ``` java if (!CoreUtils.isNullOrEmpty(applicationId)) { // Would an issue arise if the application ID is an empty string? Should we disallow that? if (applicationId.contains(" ")) { // throw error...
public HttpLogOptions setApplicationId(final String applicationId) { if (applicationId != null && (applicationId.length() > MAX_APPLICATION_ID_LENGTH || applicationId.contains(" "))) { if (applicationId.contains(" ")) { throw logger .logExceptionAsError(new IllegalArgumentException("'applicationId' must not contain a s...
if (applicationId != null
public HttpLogOptions setApplicationId(final String applicationId) { if (!CoreUtils.isNullOrEmpty(applicationId)) { if (applicationId.length() > MAX_APPLICATION_ID_LENGTH) { throw logger .logExceptionAsError(new IllegalArgumentException("'applicationId' length cannot be greater than " + MAX_APPLICATION_ID_LENGTH)); } e...
class HttpLogOptions { private String applicationId; private HttpLogDetailLevel logLevel; private Set<String> allowedHeaderNames; private Set<String> allowedQueryParamNames; private final ClientLogger logger = new ClientLogger(HttpLogOptions.class); private static final int MAX_APPLICATION_ID_LENGTH = 24; private stati...
class HttpLogOptions { private String applicationId; private HttpLogDetailLevel logLevel; private Set<String> allowedHeaderNames; private Set<String> allowedQueryParamNames; private final ClientLogger logger = new ClientLogger(HttpLogOptions.class); private static final int MAX_APPLICATION_ID_LENGTH = 24; private stati...
Could we validate the whole User-Agent string
public void customApplicationIdUserAgentTest() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { String header = request.getHeaders().getValue("User-Agent"); String expectedHeaderPrefix = "user_sp...
Assertions.assertTrue(header.startsWith(expectedHeaderPrefix));
public void customApplicationIdUserAgentTest() throws Exception { final String testSdkName = "sdk.name"; final String testAppId = "user_specified_appId"; final String testPackageVersion = "package_version"; String javaVersion = Configuration.getGlobalConfiguration().get("java.version"); String osName = Configuration.ge...
class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { Assertions.assertEquals( request.getHeaders().getValue("User-Agent"), "AutoRest-J...
class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { assertEquals( request.getHeaders().getValue("User-Agent"), "AutoRest-Java"); retu...
Simplified the logic. Currently, we are allowing empty application Id. @JonathanGiles do we want to disallow empty application Id?
public HttpLogOptions setApplicationId(final String applicationId) { if (applicationId != null && (applicationId.length() > MAX_APPLICATION_ID_LENGTH || applicationId.contains(" "))) { if (applicationId.contains(" ")) { throw logger .logExceptionAsError(new IllegalArgumentException("'applicationId' must not contain a s...
if (applicationId != null
public HttpLogOptions setApplicationId(final String applicationId) { if (!CoreUtils.isNullOrEmpty(applicationId)) { if (applicationId.length() > MAX_APPLICATION_ID_LENGTH) { throw logger .logExceptionAsError(new IllegalArgumentException("'applicationId' length cannot be greater than " + MAX_APPLICATION_ID_LENGTH)); } e...
class HttpLogOptions { private String applicationId; private HttpLogDetailLevel logLevel; private Set<String> allowedHeaderNames; private Set<String> allowedQueryParamNames; private final ClientLogger logger = new ClientLogger(HttpLogOptions.class); private static final int MAX_APPLICATION_ID_LENGTH = 24; private stati...
class HttpLogOptions { private String applicationId; private HttpLogDetailLevel logLevel; private Set<String> allowedHeaderNames; private Set<String> allowedQueryParamNames; private final ClientLogger logger = new ClientLogger(HttpLogOptions.class); private static final int MAX_APPLICATION_ID_LENGTH = 24; private stati...
added
public void customApplicationIdUserAgentTest() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { String header = request.getHeaders().getValue("User-Agent"); String expectedHeaderPrefix = "user_sp...
Assertions.assertTrue(header.startsWith(expectedHeaderPrefix));
public void customApplicationIdUserAgentTest() throws Exception { final String testSdkName = "sdk.name"; final String testAppId = "user_specified_appId"; final String testPackageVersion = "package_version"; String javaVersion = Configuration.getGlobalConfiguration().get("java.version"); String osName = Configuration.ge...
class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { Assertions.assertEquals( request.getHeaders().getValue("User-Agent"), "AutoRest-J...
class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { assertEquals( request.getHeaders().getValue("User-Agent"), "AutoRest-Java"); retu...
Use StepVerifier rather than .block()
public void defaultApplicationIdUserAgentTest() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { String header = request.getHeaders().getValue("User-Agent"); String expectedHeaderPrefix = "azsdk-...
HttpResponse response = pipeline.send(new HttpRequest(HttpMethod.GET,
public void defaultApplicationIdUserAgentTest() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { String header = request.getHeaders().getValue("User-Agent"); String expectedHeaderPrefix = "azsdk-...
class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { Assertions.assertEquals( request.getHeaders().getValue("User-Agent"), "AutoRest-J...
class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { assertEquals( request.getHeaders().getValue("User-Agent"), "AutoRest-Java"); retu...
Use step verifier.
public void customApplicationIdUserAgentTest() throws Exception { final String testSdkName = "sdk.name"; final String testAppId = "user_specified_appId"; final String testPackageVersion = "package_version"; String javaVersion = Configuration.getGlobalConfiguration().get("java.version"); String osName = Configuration.ge...
HttpResponse response = pipeline.send(new HttpRequest(HttpMethod.GET,
public void customApplicationIdUserAgentTest() throws Exception { final String testSdkName = "sdk.name"; final String testAppId = "user_specified_appId"; final String testPackageVersion = "package_version"; String javaVersion = Configuration.getGlobalConfiguration().get("java.version"); String osName = Configuration.ge...
class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { Assertions.assertEquals( request.getHeaders().getValue("User-Agent"), "AutoRest-J...
class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { assertEquals( request.getHeaders().getValue("User-Agent"), "AutoRest-Java"); retu...
I would also assert that the `response` contains the headers you expect to exist?
public void defaultApplicationIdUserAgentTest() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { String header = request.getHeaders().getValue("User-Agent"); String expectedHeaderPrefix = "azsdk-...
Assertions.assertEquals(200, response.getStatusCode());
public void defaultApplicationIdUserAgentTest() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { String header = request.getHeaders().getValue("User-Agent"); String expectedHeaderPrefix = "azsdk-...
class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { Assertions.assertEquals( request.getHeaders().getValue("User-Agent"), "AutoRest-J...
class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { assertEquals( request.getHeaders().getValue("User-Agent"), "AutoRest-Java"); retu...
Only this line should be in the `assertThrows(() -> {})`, to scope down where we expect the error to be.
public void throwsWhenIncorrectTypeInResponse() { assertThrows(AzureException.class, () -> { final Long eventHubName = 100L; final Date createdAtAsDate = new Date(1569275540L); final String[] partitionIds = new String[]{ "1", "foo", "bar", "baz" }; final Map<String, Object> values = new HashMap<>(); values.put(Managem...
serializer.deserialize(message, EventHubProperties.class);
public void throwsWhenIncorrectTypeInResponse() { final Long eventHubName = 100L; final Date createdAtAsDate = new Date(1569275540L); final String[] partitionIds = new String[]{"1", "foo", "bar", "baz"}; final Map<String, Object> values = new HashMap<>(); values.put(ManagementChannel.MANAGEMENT_ENTITY_NAME_KEY, eventHu...
class EventHubMessageSerializerTest { private final EventHubMessageSerializer serializer = new EventHubMessageSerializer(); @Test public void deserializeMessageNotNull() { assertThrows(NullPointerException.class, () -> serializer.deserialize(null, EventData.class)); } @Test public void deserializeClassNotNull() { asser...
class EventHubMessageSerializerTest { private final EventHubMessageSerializer serializer = new EventHubMessageSerializer(); @Test public void deserializeMessageNotNull() { assertThrows(NullPointerException.class, () -> serializer.deserialize(null, EventData.class)); } @Test public void deserializeClassNotNull() { asser...
Only this line should be in the `assertThrows(() -> {})`, to scope down where we expect the error to be.
public void throwsWhenNullValueInResponse() { assertThrows(AzureException.class, () -> { final String eventHubName = "event-hub-name-test"; final Date createdAtAsDate = new Date(1569275540L); final Map<String, Object> values = new HashMap<>(); values.put(ManagementChannel.MANAGEMENT_ENTITY_NAME_KEY, eventHubName); val...
serializer.deserialize(message, EventHubProperties.class);
public void throwsWhenNullValueInResponse() { final String eventHubName = "event-hub-name-test"; final Date createdAtAsDate = new Date(1569275540L); final Map<String, Object> values = new HashMap<>(); values.put(ManagementChannel.MANAGEMENT_ENTITY_NAME_KEY, eventHubName); values.put(ManagementChannel.MANAGEMENT_RESULT_...
class EventHubMessageSerializerTest { private final EventHubMessageSerializer serializer = new EventHubMessageSerializer(); @Test public void deserializeMessageNotNull() { assertThrows(NullPointerException.class, () -> serializer.deserialize(null, EventData.class)); } @Test public void deserializeClassNotNull() { asser...
class EventHubMessageSerializerTest { private final EventHubMessageSerializer serializer = new EventHubMessageSerializer(); @Test public void deserializeMessageNotNull() { assertThrows(NullPointerException.class, () -> serializer.deserialize(null, EventData.class)); } @Test public void deserializeClassNotNull() { asser...
thanks for the review. changes are incorporated
public void throwsWhenIncorrectTypeInResponse() { assertThrows(AzureException.class, () -> { final Long eventHubName = 100L; final Date createdAtAsDate = new Date(1569275540L); final String[] partitionIds = new String[]{ "1", "foo", "bar", "baz" }; final Map<String, Object> values = new HashMap<>(); values.put(Managem...
serializer.deserialize(message, EventHubProperties.class);
public void throwsWhenIncorrectTypeInResponse() { final Long eventHubName = 100L; final Date createdAtAsDate = new Date(1569275540L); final String[] partitionIds = new String[]{"1", "foo", "bar", "baz"}; final Map<String, Object> values = new HashMap<>(); values.put(ManagementChannel.MANAGEMENT_ENTITY_NAME_KEY, eventHu...
class EventHubMessageSerializerTest { private final EventHubMessageSerializer serializer = new EventHubMessageSerializer(); @Test public void deserializeMessageNotNull() { assertThrows(NullPointerException.class, () -> serializer.deserialize(null, EventData.class)); } @Test public void deserializeClassNotNull() { asser...
class EventHubMessageSerializerTest { private final EventHubMessageSerializer serializer = new EventHubMessageSerializer(); @Test public void deserializeMessageNotNull() { assertThrows(NullPointerException.class, () -> serializer.deserialize(null, EventData.class)); } @Test public void deserializeClassNotNull() { asser...
thanks for the review. changes are incorporated
public void throwsWhenNullValueInResponse() { assertThrows(AzureException.class, () -> { final String eventHubName = "event-hub-name-test"; final Date createdAtAsDate = new Date(1569275540L); final Map<String, Object> values = new HashMap<>(); values.put(ManagementChannel.MANAGEMENT_ENTITY_NAME_KEY, eventHubName); val...
serializer.deserialize(message, EventHubProperties.class);
public void throwsWhenNullValueInResponse() { final String eventHubName = "event-hub-name-test"; final Date createdAtAsDate = new Date(1569275540L); final Map<String, Object> values = new HashMap<>(); values.put(ManagementChannel.MANAGEMENT_ENTITY_NAME_KEY, eventHubName); values.put(ManagementChannel.MANAGEMENT_RESULT_...
class EventHubMessageSerializerTest { private final EventHubMessageSerializer serializer = new EventHubMessageSerializer(); @Test public void deserializeMessageNotNull() { assertThrows(NullPointerException.class, () -> serializer.deserialize(null, EventData.class)); } @Test public void deserializeClassNotNull() { asser...
class EventHubMessageSerializerTest { private final EventHubMessageSerializer serializer = new EventHubMessageSerializer(); @Test public void deserializeMessageNotNull() { assertThrows(NullPointerException.class, () -> serializer.deserialize(null, EventData.class)); } @Test public void deserializeClassNotNull() { asser...
nit: remove extra empty line
public IterableStream<PartitionEvent> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1."));...
} else if (maximumWaitTime.isNegative() || maximumWaitTime.isZero()) {
public IterableStream<PartitionEvent> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1."));...
class EventHubConsumerClient implements Closeable { private static final String RECEIVE_ALL_KEY = "receive-all"; private final ClientLogger logger = new ClientLogger(EventHubConsumerClient.class); private final ConcurrentHashMap<String, SynchronousEventSubscriber> openSubscribers = new ConcurrentHashMap<>(); private fi...
class EventHubConsumerClient implements Closeable { private static final String RECEIVE_ALL_KEY = "receive-all"; private final ClientLogger logger = new ClientLogger(EventHubConsumerClient.class); private final ConcurrentHashMap<String, SynchronousEventSubscriber> openSubscribers = new ConcurrentHashMap<>(); private fi...
Any reason why we can't just `return new IterableStream<>(events.block())` here?
public IterableStream<PartitionEvent> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1."));...
return new IterableStream<>(map);
public IterableStream<PartitionEvent> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1."));...
class EventHubConsumerClient implements Closeable { private static final String RECEIVE_ALL_KEY = "receive-all"; private final ClientLogger logger = new ClientLogger(EventHubConsumerClient.class); private final ConcurrentHashMap<String, SynchronousEventSubscriber> openSubscribers = new ConcurrentHashMap<>(); private fi...
class EventHubConsumerClient implements Closeable { private static final String RECEIVE_ALL_KEY = "receive-all"; private final ClientLogger logger = new ClientLogger(EventHubConsumerClient.class); private final ConcurrentHashMap<String, SynchronousEventSubscriber> openSubscribers = new ConcurrentHashMap<>(); private fi...
Good catch, I used it before for debugging.
public IterableStream<PartitionEvent> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1."));...
return new IterableStream<>(map);
public IterableStream<PartitionEvent> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1."));...
class EventHubConsumerClient implements Closeable { private static final String RECEIVE_ALL_KEY = "receive-all"; private final ClientLogger logger = new ClientLogger(EventHubConsumerClient.class); private final ConcurrentHashMap<String, SynchronousEventSubscriber> openSubscribers = new ConcurrentHashMap<>(); private fi...
class EventHubConsumerClient implements Closeable { private static final String RECEIVE_ALL_KEY = "receive-all"; private final ClientLogger logger = new ClientLogger(EventHubConsumerClient.class); private final ConcurrentHashMap<String, SynchronousEventSubscriber> openSubscribers = new ConcurrentHashMap<>(); private fi...
The `map` operation can be removed in `receive(String partitionId, int maximumMessageCount, Duration maximumWaitTime)` overload as well.
public IterableStream<PartitionEvent> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1."));...
final Flux<PartitionEvent> events = Flux.create(emitter -> {
public IterableStream<PartitionEvent> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1."));...
class EventHubConsumerClient implements Closeable { private static final String RECEIVE_ALL_KEY = "receive-all"; private final ClientLogger logger = new ClientLogger(EventHubConsumerClient.class); private final ConcurrentHashMap<String, SynchronousEventSubscriber> openSubscribers = new ConcurrentHashMap<>(); private fi...
class EventHubConsumerClient implements Closeable { private static final String RECEIVE_ALL_KEY = "receive-all"; private final ClientLogger logger = new ClientLogger(EventHubConsumerClient.class); private final ConcurrentHashMap<String, SynchronousEventSubscriber> openSubscribers = new ConcurrentHashMap<>(); private fi...
Why do we set this to `null` then pass it into the builder?
public void setup() throws InvalidKeyException, NoSuchAlgorithmException { if (interceptorManager.isPlaybackMode()) { connectionString = "Endpoint=http: tokenCredential = null; String endpoint = new ConfigurationClientCredentials(connectionString).getBaseUri(); client = new ConfigurationClientBuilder() .credential(toke...
tokenCredential = null;
public void setup() throws InvalidKeyException, NoSuchAlgorithmException { if (interceptorManager.isPlaybackMode()) { connectionString = "Endpoint=http: String endpoint = new ConfigurationClientCredentials(connectionString).getBaseUri(); client = new ConfigurationClientBuilder() .connectionString(connectionString) .end...
class AadCredentialTest extends TestBase { private static ConfigurationClient client; private static final String AZURE_APPCONFIG_CONNECTION_STRING = "AZURE_APPCONFIG_CONNECTION_STRING"; static String connectionString; static TokenCredential tokenCredential; @BeforeEach @Test public void aadAuthenticationAzConfigClient...
class AadCredentialTest extends TestBase { private static ConfigurationClient client; private static final String AZURE_APPCONFIG_CONNECTION_STRING = "AZURE_APPCONFIG_CONNECTION_STRING"; static String connectionString; static TokenCredential tokenCredential; @BeforeEach @Test public void aadAuthenticationAzConfigClient...
Same comment as the README, let's talk about accessing the portal when discussing getting endpoint for TokenCredential, at least make it more prominent and talk about it before connection strings.
public static void main(String[] args) { String endpoint = "{endpoint_value}"; TokenCredential tokenCredential = null; final ConfigurationClient client = new ConfigurationClientBuilder() .credential(tokenCredential) .endpoint(endpoint) .buildClient(); final String key = "hello"; final String value = "world"; System.out...
public static void main(String[] args) { String endpoint = "{endpoint_value}"; TokenCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); final ConfigurationClient client = new ConfigurationClientBuilder() .credential(tokenCredential) .endpoint(endpoint) .buildClient(); final String key = "hello"; f...
class AadAuthentication { /** * Sample for how to use AAD token Authentication. * * @param args Unused. Arguments to the program. */ }
class AadAuthentication { /** * Sample for how to use AAD token Authentication. * * @param args Unused. Arguments to the program. */ }
Let's use a mutli-line comment for this
public static void main(String[] args) { String endpoint = "{endpoint_value}"; TokenCredential tokenCredential = null; final ConfigurationClient client = new ConfigurationClientBuilder() .credential(tokenCredential) .endpoint(endpoint) .buildClient(); final String key = "hello"; final String value = "world"; System.out...
public static void main(String[] args) { String endpoint = "{endpoint_value}"; TokenCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); final ConfigurationClient client = new ConfigurationClientBuilder() .credential(tokenCredential) .endpoint(endpoint) .buildClient(); final String key = "hello"; f...
class AadAuthentication { /** * Sample for how to use AAD token Authentication. * * @param args Unused. Arguments to the program. */ }
class AadAuthentication { /** * Sample for how to use AAD token Authentication. * * @param args Unused. Arguments to the program. */ }
We are mocking the tokenCredentail which is not use anyway. So I think null value will be sufficient
public void setup() throws InvalidKeyException, NoSuchAlgorithmException { if (interceptorManager.isPlaybackMode()) { connectionString = "Endpoint=http: tokenCredential = null; String endpoint = new ConfigurationClientCredentials(connectionString).getBaseUri(); client = new ConfigurationClientBuilder() .credential(toke...
tokenCredential = null;
public void setup() throws InvalidKeyException, NoSuchAlgorithmException { if (interceptorManager.isPlaybackMode()) { connectionString = "Endpoint=http: String endpoint = new ConfigurationClientCredentials(connectionString).getBaseUri(); client = new ConfigurationClientBuilder() .connectionString(connectionString) .end...
class AadCredentialTest extends TestBase { private static ConfigurationClient client; private static final String AZURE_APPCONFIG_CONNECTION_STRING = "AZURE_APPCONFIG_CONNECTION_STRING"; static String connectionString; static TokenCredential tokenCredential; @BeforeEach @Test public void aadAuthenticationAzConfigClient...
class AadCredentialTest extends TestBase { private static ConfigurationClient client; private static final String AZURE_APPCONFIG_CONNECTION_STRING = "AZURE_APPCONFIG_CONNECTION_STRING"; static String connectionString; static TokenCredential tokenCredential; @BeforeEach @Test public void aadAuthenticationAzConfigClient...
Gotcha, didn't notice that this was a sample.
public void setup() throws InvalidKeyException, NoSuchAlgorithmException { if (interceptorManager.isPlaybackMode()) { connectionString = "Endpoint=http: tokenCredential = null; String endpoint = new ConfigurationClientCredentials(connectionString).getBaseUri(); client = new ConfigurationClientBuilder() .credential(toke...
tokenCredential = null;
public void setup() throws InvalidKeyException, NoSuchAlgorithmException { if (interceptorManager.isPlaybackMode()) { connectionString = "Endpoint=http: String endpoint = new ConfigurationClientCredentials(connectionString).getBaseUri(); client = new ConfigurationClientBuilder() .connectionString(connectionString) .end...
class AadCredentialTest extends TestBase { private static ConfigurationClient client; private static final String AZURE_APPCONFIG_CONNECTION_STRING = "AZURE_APPCONFIG_CONNECTION_STRING"; static String connectionString; static TokenCredential tokenCredential; @BeforeEach @Test public void aadAuthenticationAzConfigClient...
class AadCredentialTest extends TestBase { private static ConfigurationClient client; private static final String AZURE_APPCONFIG_CONNECTION_STRING = "AZURE_APPCONFIG_CONNECTION_STRING"; static String connectionString; static TokenCredential tokenCredential; @BeforeEach @Test public void aadAuthenticationAzConfigClient...
```suggestion // In playback mode use connection string because CI environment doesn't set up to support AAD ```
public void setup() throws InvalidKeyException, NoSuchAlgorithmException { if (interceptorManager.isPlaybackMode()) { connectionString = "Endpoint=http: String endpoint = new ConfigurationClientCredentials(connectionString).getBaseUri(); client = new ConfigurationClientBuilder() .connectionString(connectionString) .end...
public void setup() throws InvalidKeyException, NoSuchAlgorithmException { if (interceptorManager.isPlaybackMode()) { connectionString = "Endpoint=http: String endpoint = new ConfigurationClientCredentials(connectionString).getBaseUri(); client = new ConfigurationClientBuilder() .connectionString(connectionString) .end...
class AadCredentialTest extends TestBase { private static ConfigurationClient client; private static final String AZURE_APPCONFIG_CONNECTION_STRING = "AZURE_APPCONFIG_CONNECTION_STRING"; static String connectionString; static TokenCredential tokenCredential; @BeforeEach @Test public void aadAuthenticationAzConfigClient...
class AadCredentialTest extends TestBase { private static ConfigurationClient client; private static final String AZURE_APPCONFIG_CONNECTION_STRING = "AZURE_APPCONFIG_CONNECTION_STRING"; static String connectionString; static TokenCredential tokenCredential; @BeforeEach @Test public void aadAuthenticationAzConfigClient...
This should be `connection.getFullyQualifiedNamespace()`
String getFullyQualifiedNamespace() { return connection.getFullyQualifiedDomainName(); }
return connection.getFullyQualifiedDomainName();
String getFullyQualifiedNamespace() { return connection.getFullyQualifiedNamespace(); }
class EventHubAsyncClient implements Closeable { private final ClientLogger logger = new ClientLogger(EventHubAsyncClient.class); private final MessageSerializer messageSerializer; private final EventHubConnection connection; private final boolean isSharedConnection; private final EventHubConsumerOptions defaultConsume...
class EventHubAsyncClient implements Closeable { private final ClientLogger logger = new ClientLogger(EventHubAsyncClient.class); private final MessageSerializer messageSerializer; private final EventHubConnection connection; private final boolean isSharedConnection; private final EventHubConsumerOptions defaultConsume...
Why isn't this just called CertificateIssuer~~Set~~Parameters ?
Mono<Response<CertificateIssuer>> createIssuerWithResponse(CertificateIssuer issuer, Context context) { CertificateIssuerSetParameters parameters = new CertificateIssuerSetParameters() .provider(issuer.getProperties().getProvider()) .credentials(new IssuerCredentials().accountId(issuer.getAccountId()).password(issuer.g...
CertificateIssuerSetParameters parameters = new CertificateIssuerSetParameters()
new CertificateIssuerSetParameters() .provider(provider); return service.setCertificateIssuer(vaultUrl, API_VERSION, ACCEPT_LANGUAGE, name, parameters, CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Creating certificate issuer - {}
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private final String vaultUrl; private final CertificateService service; private fina...
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; static final String KEY_VAULT_SCOPE = "https: private final String vaultUrl; private ...
internal class, made to match Rest API
Mono<Response<CertificateIssuer>> createIssuerWithResponse(CertificateIssuer issuer, Context context) { CertificateIssuerSetParameters parameters = new CertificateIssuerSetParameters() .provider(issuer.getProperties().getProvider()) .credentials(new IssuerCredentials().accountId(issuer.getAccountId()).password(issuer.g...
CertificateIssuerSetParameters parameters = new CertificateIssuerSetParameters()
new CertificateIssuerSetParameters() .provider(provider); return service.setCertificateIssuer(vaultUrl, API_VERSION, ACCEPT_LANGUAGE, name, parameters, CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Creating certificate issuer - {}
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private final String vaultUrl; private final CertificateService service; private fina...
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; static final String KEY_VAULT_SCOPE = "https: private final String vaultUrl; private ...
code snippets should be renamed to beginCreateCertificate
Mono<Response<CertificateOperation>> createCertificateWithResponse(String name, CertificatePolicy certificatePolicy, boolean enabled, Map<String, String> tags, Context context) { CertificateRequestParameters certificateRequestParameters = new CertificateRequestParameters() .certificatePolicy(new CertificatePolicyReques...
return service.createCertificate(vaultUrl, name, API_VERSION, ACCEPT_LANGUAGE, certificateRequestParameters, CONTENT_TYPE_HEADER_VALUE, context);
new CertificateRequestParameters() .certificatePolicy(new CertificatePolicyRequest(certificatePolicy)) .certificateAttributes(new CertificateRequestAttributes().enabled(enabled)) .tags(tags); return service.createCertificate(vaultUrl, name, API_VERSION, ACCEPT_LANGUAGE, certificateRequestParameters, CONTENT_TYPE_HEADER...
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private final String vaultUrl; private final CertificateService service; private fina...
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; static final String KEY_VAULT_SCOPE = "https: private final String vaultUrl; private ...