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 |
|---|---|---|---|---|---|
could you please add an `assert(databaseAccount != null)` here. for sanity check and readibility. | private void initializeGatewayConfigurationReader() {
this.gatewayConfigurationReader = new GatewayServiceConfigurationReader(this.serviceEndpoint, this.globalEndpointManager);
DatabaseAccount databaseAccount = this.globalEndpointManager.getLatestDatabaseAccount();
this.useMultipleWriteLocations = this.connectionPolicy... | DatabaseAccount databaseAccount = this.globalEndpointManager.getLatestDatabaseAccount(); | private void initializeGatewayConfigurationReader() {
this.gatewayConfigurationReader = new GatewayServiceConfigurationReader(this.globalEndpointManager);
DatabaseAccount databaseAccount = this.globalEndpointManager.getLatestDatabaseAccount();
assert(databaseAccount != null);
this.useMultipleWriteLocations = this.conne... | class RxDocumentClientImpl implements AsyncDocumentClient, IAuthorizationTokenProvider {
private final static ObjectMapper mapper = Utils.getSimpleObjectMapper();
private final Logger logger = LoggerFactory.getLogger(RxDocumentClientImpl.class);
private final String masterKeyOrResourceToken;
private final URI serviceEn... | class RxDocumentClientImpl implements AsyncDocumentClient, IAuthorizationTokenProvider {
private final static ObjectMapper mapper = Utils.getSimpleObjectMapper();
private final Logger logger = LoggerFactory.getLogger(RxDocumentClientImpl.class);
private final String masterKeyOrResourceToken;
private final URI serviceEn... |
does this mean there is a window of time where there is an invalid result in the cache? | private Mono<DatabaseAccount> getDatabaseAccountAsync(URI serviceEndpoint) {
final GlobalEndpointManager that = this;
Callable<Mono<DatabaseAccount>> fetchDatabaseAccount = () -> {
return that.owner.getDatabaseAccountFromEndpoint(serviceEndpoint).doOnNext(databaseAccount -> {
if(databaseAccount != null) {
this.latestDa... | databaseAccountAsyncCache.set(StringUtils.EMPTY, obsoleteValue); | private Mono<DatabaseAccount> getDatabaseAccountAsync(URI serviceEndpoint) {
return this.owner.getDatabaseAccountFromEndpoint(serviceEndpoint)
.doOnNext(databaseAccount -> {
if(databaseAccount != null) {
this.latestDatabaseAccount = databaseAccount;
}
logger.debug("account retrieved: {}", databaseAccount);
}).single();... | class GlobalEndpointManager implements AutoCloseable {
private static final Logger logger = LoggerFactory.getLogger(GlobalEndpointManager.class);
private final int backgroundRefreshLocationTimeIntervalInMS;
private final LocationCache locationCache;
private final URI defaultEndpoint;
private final ConnectionPolicy conn... | class GlobalEndpointManager implements AutoCloseable {
private static final Logger logger = LoggerFactory.getLogger(GlobalEndpointManager.class);
private final int backgroundRefreshLocationTimeIntervalInMS;
private final LocationCache locationCache;
private final URI defaultEndpoint;
private final ConnectionPolicy conn... |
Yes | private Mono<DatabaseAccount> getDatabaseAccountAsync(URI serviceEndpoint) {
final GlobalEndpointManager that = this;
Callable<Mono<DatabaseAccount>> fetchDatabaseAccount = () -> {
return that.owner.getDatabaseAccountFromEndpoint(serviceEndpoint).doOnNext(databaseAccount -> {
if(databaseAccount != null) {
this.latestDa... | databaseAccountAsyncCache.set(StringUtils.EMPTY, obsoleteValue); | private Mono<DatabaseAccount> getDatabaseAccountAsync(URI serviceEndpoint) {
return this.owner.getDatabaseAccountFromEndpoint(serviceEndpoint)
.doOnNext(databaseAccount -> {
if(databaseAccount != null) {
this.latestDatabaseAccount = databaseAccount;
}
logger.debug("account retrieved: {}", databaseAccount);
}).single();... | class GlobalEndpointManager implements AutoCloseable {
private static final Logger logger = LoggerFactory.getLogger(GlobalEndpointManager.class);
private final int backgroundRefreshLocationTimeIntervalInMS;
private final LocationCache locationCache;
private final URI defaultEndpoint;
private final ConnectionPolicy conn... | class GlobalEndpointManager implements AutoCloseable {
private static final Logger logger = LoggerFactory.getLogger(GlobalEndpointManager.class);
private final int backgroundRefreshLocationTimeIntervalInMS;
private final LocationCache locationCache;
private final URI defaultEndpoint;
private final ConnectionPolicy conn... |
done | public DatabaseAccount getLatestDatabaseAccount() {
return this.latestDatabaseAccount;
} | return this.latestDatabaseAccount; | public DatabaseAccount getLatestDatabaseAccount() {
return this.latestDatabaseAccount;
} | class GlobalEndpointManager implements AutoCloseable {
private static final Logger logger = LoggerFactory.getLogger(GlobalEndpointManager.class);
private final int backgroundRefreshLocationTimeIntervalInMS;
private final LocationCache locationCache;
private final URI defaultEndpoint;
private final ConnectionPolicy conn... | class GlobalEndpointManager implements AutoCloseable {
private static final Logger logger = LoggerFactory.getLogger(GlobalEndpointManager.class);
private final int backgroundRefreshLocationTimeIntervalInMS;
private final LocationCache locationCache;
private final URI defaultEndpoint;
private final ConnectionPolicy conn... |
done | private void initializeGatewayConfigurationReader() {
this.gatewayConfigurationReader = new GatewayServiceConfigurationReader(this.serviceEndpoint, this.globalEndpointManager);
DatabaseAccount databaseAccount = this.globalEndpointManager.getLatestDatabaseAccount();
this.useMultipleWriteLocations = this.connectionPolicy... | DatabaseAccount databaseAccount = this.globalEndpointManager.getLatestDatabaseAccount(); | private void initializeGatewayConfigurationReader() {
this.gatewayConfigurationReader = new GatewayServiceConfigurationReader(this.globalEndpointManager);
DatabaseAccount databaseAccount = this.globalEndpointManager.getLatestDatabaseAccount();
assert(databaseAccount != null);
this.useMultipleWriteLocations = this.conne... | class RxDocumentClientImpl implements AsyncDocumentClient, IAuthorizationTokenProvider {
private final static ObjectMapper mapper = Utils.getSimpleObjectMapper();
private final Logger logger = LoggerFactory.getLogger(RxDocumentClientImpl.class);
private final String masterKeyOrResourceToken;
private final URI serviceEn... | class RxDocumentClientImpl implements AsyncDocumentClient, IAuthorizationTokenProvider {
private final static ObjectMapper mapper = Utils.getSimpleObjectMapper();
private final Logger logger = LoggerFactory.getLogger(RxDocumentClientImpl.class);
private final String masterKeyOrResourceToken;
private final URI serviceEn... |
We may need to create a resource group name, will need to handle logic slightly differently here. When tests are running in an Azure Pipeline we should trust that the resource group name is associated to an existing resource group. If there isn't a resource group environment variable we need to create the resource gro... | public void createResourceGroup() {
if (resourceGroup == null) {
String resourceGroupName = Configuration.getGlobalConfiguration().get(AZURE_RESOURCEGROUP_NAME);
System.out.println("Creating Resource Group: " + resourceGroupName);
resourceGroup = azure.resourceGroups()
.define(resourceGroupName)
.withRegion(location)
.... | public void createResourceGroup() {
String resourceGroupName = Configuration.getGlobalConfiguration().get(AZURE_RESOURCEGROUP_NAME);
if (azure.resourceGroups().checkExistence(resourceGroupName)) {
System.out.println("Fetching Resource Group: " + resourceGroupName);
resourceGroup = azure.resourceGroups()
.getByName(reso... | class variables
* to be retrieved later.
*/
public void initialize() {
validate();
if (azure == null) {
azure = Azure.configure()
.authenticate(azureTokenCredentials)
.withSubscription(subscriptionId);
}
} | class variables
* to be retrieved later.
*/
public void initialize() {
validate();
if (azure == null) {
azure = Azure.configure()
.authenticate(azureTokenCredentials)
.withSubscription(subscriptionId);
}
} | |
Any particular reason we are adding a call the resource group creation but removing one to group deletion? | public static void afterAll() {
} | public static void afterAll() {
} | class SearchServiceTestBase extends TestBase {
private static final String DEFAULT_DNS_SUFFIX = "search.windows.net";
private static final String DOGFOOD_DNS_SUFFIX = "search-dogfood.windows-int.net";
private static final String FAKE_DESCRIPTION = "Some data source";
private static final String AZURE_TEST_MODE = "AZURE... | class SearchServiceTestBase extends TestBase {
private static final String DEFAULT_DNS_SUFFIX = "search.windows.net";
private static final String DOGFOOD_DNS_SUFFIX = "search-dogfood.windows-int.net";
private static final String FAKE_DESCRIPTION = "Some data source";
private static final String AZURE_TEST_MODE = "AZURE... | |
Same comment about non-needed try/catch | public Mono<Boolean> exists() {
try {
return existsWithResponse().flatMap(FluxUtil::toMono);
} catch (RuntimeException ex) {
return monoError(logger, ex);
}
} | return monoError(logger, ex); | public Mono<Boolean> exists() {
return existsWithResponse().flatMap(FluxUtil::toMono);
} | class ShareDirectoryAsyncClient {
private final ClientLogger logger = new ClientLogger(ShareDirectoryAsyncClient.class);
private final AzureFileStorageImpl azureFileStorageClient;
private final String shareName;
private final String directoryPath;
private final String snapshot;
private final String accountName;
private... | class ShareDirectoryAsyncClient {
private final ClientLogger logger = new ClientLogger(ShareDirectoryAsyncClient.class);
private final AzureFileStorageImpl azureFileStorageClient;
private final String shareName;
private final String directoryPath;
private final String snapshot;
private final String accountName;
private... |
Change the logic here to if resourceGroup exists, get the resource group. If resourceGroup not exist, create an resource group. By doing this, the entire test run only needs one resource group, so it does not need to delete every test class, which answered your question below. | public void createResourceGroup() {
if (resourceGroup == null) {
String resourceGroupName = Configuration.getGlobalConfiguration().get(AZURE_RESOURCEGROUP_NAME);
System.out.println("Creating Resource Group: " + resourceGroupName);
resourceGroup = azure.resourceGroups()
.define(resourceGroupName)
.withRegion(location)
.... | public void createResourceGroup() {
String resourceGroupName = Configuration.getGlobalConfiguration().get(AZURE_RESOURCEGROUP_NAME);
if (azure.resourceGroups().checkExistence(resourceGroupName)) {
System.out.println("Fetching Resource Group: " + resourceGroupName);
resourceGroup = azure.resourceGroups()
.getByName(reso... | class variables
* to be retrieved later.
*/
public void initialize() {
validate();
if (azure == null) {
azure = Azure.configure()
.authenticate(azureTokenCredentials)
.withSubscription(subscriptionId);
}
} | class variables
* to be retrieved later.
*/
public void initialize() {
validate();
if (azure == null) {
azure = Azure.configure()
.authenticate(azureTokenCredentials)
.withSubscription(subscriptionId);
}
} | |
One resource group for the entire tests, so there is no need to delete for every test class | public static void afterAll() {
} | public static void afterAll() {
} | class SearchServiceTestBase extends TestBase {
private static final String DEFAULT_DNS_SUFFIX = "search.windows.net";
private static final String DOGFOOD_DNS_SUFFIX = "search-dogfood.windows-int.net";
private static final String FAKE_DESCRIPTION = "Some data source";
private static final String AZURE_TEST_MODE = "AZURE... | class SearchServiceTestBase extends TestBase {
private static final String DEFAULT_DNS_SUFFIX = "search.windows.net";
private static final String DOGFOOD_DNS_SUFFIX = "search-dogfood.windows-int.net";
private static final String FAKE_DESCRIPTION = "Some data source";
private static final String AZURE_TEST_MODE = "AZURE... | |
Shouldn't need to try catch here given the overload being called already does this. | public Mono<Boolean> exists() {
try {
return existsWithResponse().flatMap(FluxUtil::toMono);
} catch (RuntimeException ex) {
return monoError(logger, ex);
}
} | } | public Mono<Boolean> exists() {
return existsWithResponse().flatMap(FluxUtil::toMono);
} | class ShareAsyncClient {
private final ClientLogger logger = new ClientLogger(ShareAsyncClient.class);
private final AzureFileStorageImpl azureFileStorageClient;
private final String shareName;
private final String snapshot;
private final String accountName;
private final ShareServiceVersion serviceVersion;
/**
* Creat... | class ShareAsyncClient {
private final ClientLogger logger = new ClientLogger(ShareAsyncClient.class);
private final AzureFileStorageImpl azureFileStorageClient;
private final String shareName;
private final String snapshot;
private final String accountName;
private final ShareServiceVersion serviceVersion;
/**
* Creat... |
might at least be helpful to make it a constant so we dont have to dig around for them later. ya know? | public void copy(Path source, Path destination, CopyOption... copyOptions) throws IOException {
if (!(source instanceof AzurePath && destination instanceof AzurePath)) {
throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of "
+ "Path other than AzurePath"));
}
if (sour... | pollResponse.waitForCompletion(Duration.ofSeconds(30)); | public void copy(Path source, Path destination, CopyOption... copyOptions) throws IOException {
if (!(source instanceof AzurePath && destination instanceof AzurePath)) {
throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of "
+ "Path other than AzurePath"));
}
if (sour... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... |
I know this isnt part of this particular PR but do you think it might be useful to catch the specific Error Code as well here? | public void createDirectory(Path path, FileAttribute<?>... fileAttributes) throws IOException {
if (!(path instanceof AzurePath)) {
throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of "
+ "Path other than AzurePath"));
}
fileAttributes = fileAttributes == null ? new ... | if (e.getStatusCode() == HttpURLConnection.HTTP_CONFLICT) { | public void createDirectory(Path path, FileAttribute<?>... fileAttributes) throws IOException {
if (!(path instanceof AzurePath)) {
throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of "
+ "Path other than AzurePath"));
}
fileAttributes = fileAttributes == null ? new ... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... |
Would it be helpful to a user to separate these checks so they know which is illegal? | public void copy(Path source, Path destination, CopyOption... copyOptions) throws IOException {
if (!(source instanceof AzurePath && destination instanceof AzurePath)) {
throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of "
+ "Path other than AzurePath"));
}
if (sour... | throw Utility.logError(logger, new IllegalArgumentException(String.format("Neither source nor destination " | public void copy(Path source, Path destination, CopyOption... copyOptions) throws IOException {
if (!(source instanceof AzurePath && destination instanceof AzurePath)) {
throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of "
+ "Path other than AzurePath"));
}
if (sour... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... |
Is there a reason for the duration being 30 here? | public void copy(Path source, Path destination, CopyOption... copyOptions) throws IOException {
if (!(source instanceof AzurePath && destination instanceof AzurePath)) {
throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of "
+ "Path other than AzurePath"));
}
if (sour... | pollResponse.waitForCompletion(Duration.ofSeconds(30)); | public void copy(Path source, Path destination, CopyOption... copyOptions) throws IOException {
if (!(source instanceof AzurePath && destination instanceof AzurePath)) {
throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of "
+ "Path other than AzurePath"));
}
if (sour... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... |
I actually just refactored this to do exactly that :). It'll be in my next PR. | public void copy(Path source, Path destination, CopyOption... copyOptions) throws IOException {
if (!(source instanceof AzurePath && destination instanceof AzurePath)) {
throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of "
+ "Path other than AzurePath"));
}
if (sour... | throw Utility.logError(logger, new IllegalArgumentException(String.format("Neither source nor destination " | public void copy(Path source, Path destination, CopyOption... copyOptions) throws IOException {
if (!(source instanceof AzurePath && destination instanceof AzurePath)) {
throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of "
+ "Path other than AzurePath"));
}
if (sour... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... |
Nope. Just a magic number plus being a little lazy about adding a constant/option. I figure we can add an option for it if/when people are dissatisfied with this. Or I can add an option now. :P | public void copy(Path source, Path destination, CopyOption... copyOptions) throws IOException {
if (!(source instanceof AzurePath && destination instanceof AzurePath)) {
throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of "
+ "Path other than AzurePath"));
}
if (sour... | pollResponse.waitForCompletion(Duration.ofSeconds(30)); | public void copy(Path source, Path destination, CopyOption... copyOptions) throws IOException {
if (!(source instanceof AzurePath && destination instanceof AzurePath)) {
throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of "
+ "Path other than AzurePath"));
}
if (sour... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... |
Indenttaion | public AsyncDocumentClient build() {
ifThrowIllegalArgException(this.serviceEndpoint == null, "cannot buildAsyncClient client without service endpoint");
ifThrowIllegalArgException(
this.masterKeyOrResourceToken == null && (permissionFeed == null || permissionFeed.isEmpty())
&& this.cosmosAuthorizationTokenResolver == ... | cosmosAuthorizationTokenResolver, | public AsyncDocumentClient build() {
ifThrowIllegalArgException(this.serviceEndpoint == null, "cannot buildAsyncClient client without service endpoint");
ifThrowIllegalArgException(
this.masterKeyOrResourceToken == null && (permissionFeed == null || permissionFeed.isEmpty())
&& this.cosmosAuthorizationTokenResolver == ... | class Builder {
Configs configs = new Configs();
ConnectionPolicy connectionPolicy;
ConsistencyLevel desiredConsistencyLevel;
List<Permission> permissionFeed;
String masterKeyOrResourceToken;
URI serviceEndpoint;
CosmosAuthorizationTokenResolver cosmosAuthorizationTokenResolver;
CosmosKeyCredential cosmosKeyCredential;... | class Builder {
Configs configs = new Configs();
ConnectionPolicy connectionPolicy;
ConsistencyLevel desiredConsistencyLevel;
List<Permission> permissionFeed;
String masterKeyOrResourceToken;
URI serviceEndpoint;
CosmosAuthorizationTokenResolver cosmosAuthorizationTokenResolver;
CosmosKeyCredential cosmosKeyCredential;... |
will fix. thanks. result of intellji auto rename. | public AsyncDocumentClient build() {
ifThrowIllegalArgException(this.serviceEndpoint == null, "cannot buildAsyncClient client without service endpoint");
ifThrowIllegalArgException(
this.masterKeyOrResourceToken == null && (permissionFeed == null || permissionFeed.isEmpty())
&& this.cosmosAuthorizationTokenResolver == ... | cosmosAuthorizationTokenResolver, | public AsyncDocumentClient build() {
ifThrowIllegalArgException(this.serviceEndpoint == null, "cannot buildAsyncClient client without service endpoint");
ifThrowIllegalArgException(
this.masterKeyOrResourceToken == null && (permissionFeed == null || permissionFeed.isEmpty())
&& this.cosmosAuthorizationTokenResolver == ... | class Builder {
Configs configs = new Configs();
ConnectionPolicy connectionPolicy;
ConsistencyLevel desiredConsistencyLevel;
List<Permission> permissionFeed;
String masterKeyOrResourceToken;
URI serviceEndpoint;
CosmosAuthorizationTokenResolver cosmosAuthorizationTokenResolver;
CosmosKeyCredential cosmosKeyCredential;... | class Builder {
Configs configs = new Configs();
ConnectionPolicy connectionPolicy;
ConsistencyLevel desiredConsistencyLevel;
List<Permission> permissionFeed;
String masterKeyOrResourceToken;
URI serviceEndpoint;
CosmosAuthorizationTokenResolver cosmosAuthorizationTokenResolver;
CosmosKeyCredential cosmosKeyCredential;... |
addressed. | public AsyncDocumentClient build() {
ifThrowIllegalArgException(this.serviceEndpoint == null, "cannot buildAsyncClient client without service endpoint");
ifThrowIllegalArgException(
this.masterKeyOrResourceToken == null && (permissionFeed == null || permissionFeed.isEmpty())
&& this.cosmosAuthorizationTokenResolver == ... | cosmosAuthorizationTokenResolver, | public AsyncDocumentClient build() {
ifThrowIllegalArgException(this.serviceEndpoint == null, "cannot buildAsyncClient client without service endpoint");
ifThrowIllegalArgException(
this.masterKeyOrResourceToken == null && (permissionFeed == null || permissionFeed.isEmpty())
&& this.cosmosAuthorizationTokenResolver == ... | class Builder {
Configs configs = new Configs();
ConnectionPolicy connectionPolicy;
ConsistencyLevel desiredConsistencyLevel;
List<Permission> permissionFeed;
String masterKeyOrResourceToken;
URI serviceEndpoint;
CosmosAuthorizationTokenResolver cosmosAuthorizationTokenResolver;
CosmosKeyCredential cosmosKeyCredential;... | class Builder {
Configs configs = new Configs();
ConnectionPolicy connectionPolicy;
ConsistencyLevel desiredConsistencyLevel;
List<Permission> permissionFeed;
String masterKeyOrResourceToken;
URI serviceEndpoint;
CosmosAuthorizationTokenResolver cosmosAuthorizationTokenResolver;
CosmosKeyCredential cosmosKeyCredential;... |
fyi - I am not removing this onBeforeSendRequest , moving it early in the stack to getCreateDocumentRequest method , ensuring we are capturing meta data (collection calls) in retries | private Mono<RxDocumentServiceResponse> replace(RxDocumentServiceRequest request, DocumentClientRetryPolicy documentClientRetryPolicy) {
populateHeaders(request, RequestVerb.PUT);
if(request.requestContext != null && documentClientRetryPolicy.getRetryCount() > 0) {
documentClientRetryPolicy.updateEndTime();
request.req... | return getStoreProxy(request).processMessage(request); | private Mono<RxDocumentServiceResponse> replace(RxDocumentServiceRequest request, DocumentClientRetryPolicy documentClientRetryPolicy) {
populateHeaders(request, RequestVerb.PUT);
if(request.requestContext != null && documentClientRetryPolicy.getRetryCount() > 0) {
documentClientRetryPolicy.updateEndTime();
request.req... | class RxDocumentClientImpl implements AsyncDocumentClient, IAuthorizationTokenProvider {
private final static ObjectMapper mapper = Utils.getSimpleObjectMapper();
private final Logger logger = LoggerFactory.getLogger(RxDocumentClientImpl.class);
private final String masterKeyOrResourceToken;
private final URI serviceEn... | class RxDocumentClientImpl implements AsyncDocumentClient, IAuthorizationTokenProvider {
private final static ObjectMapper mapper = Utils.getSimpleObjectMapper();
private final Logger logger = LoggerFactory.getLogger(RxDocumentClientImpl.class);
private final String masterKeyOrResourceToken;
private final URI serviceEn... |
Should we convert time to `Instant` type? On the span, would a string formatted datetime make it easier than a long? | private void addSpanRequestAttributes(Span span, Context context, String spanName) {
Objects.requireNonNull(span, "'span' cannot be null.");
String entityPath = getOrDefault(context, ENTITY_PATH_KEY, null, String.class);
if (entityPath != null) {
span.setAttribute(MESSAGE_BUS_DESTINATION, AttributeValue.stringAttribute... | Long messageEnqueuedTime = getOrDefault(context, MESSAGE_ENQUEUED_TIME, null, Long.class); | private void addSpanRequestAttributes(Span span, Context context, String spanName) {
Objects.requireNonNull(span, "'span' cannot be null.");
String entityPath = getOrDefault(context, ENTITY_PATH_KEY, null, String.class);
if (entityPath != null) {
span.setAttribute(MESSAGE_BUS_DESTINATION, AttributeValue.stringAttribute... | class OpenTelemetryTracer implements com.azure.core.util.tracing.Tracer {
private static final Tracer TRACER = OpenTelemetry.getTracerFactory().get("Azure-OpenTelemetry");
static final String AZ_NAMESPACE_KEY = "az.namespace";
static final String MESSAGE_BUS_DESTINATION = "message_bus.destination";
static final String ... | class OpenTelemetryTracer implements com.azure.core.util.tracing.Tracer {
private static final Tracer TRACER = OpenTelemetry.getTracerFactory().get("Azure-OpenTelemetry");
static final String AZ_NAMESPACE_KEY = "az.namespace";
static final String MESSAGE_BUS_DESTINATION = "message_bus.destination";
static final String ... |
the purpose of `getCreateDocumentRequest` is just to create the request. retry-policy interaction should happen outside. why are we moving this? | private Mono<RxDocumentServiceResponse> replace(RxDocumentServiceRequest request, DocumentClientRetryPolicy documentClientRetryPolicy) {
populateHeaders(request, RequestVerb.PUT);
if(request.requestContext != null && documentClientRetryPolicy.getRetryCount() > 0) {
documentClientRetryPolicy.updateEndTime();
request.req... | return getStoreProxy(request).processMessage(request); | private Mono<RxDocumentServiceResponse> replace(RxDocumentServiceRequest request, DocumentClientRetryPolicy documentClientRetryPolicy) {
populateHeaders(request, RequestVerb.PUT);
if(request.requestContext != null && documentClientRetryPolicy.getRetryCount() > 0) {
documentClientRetryPolicy.updateEndTime();
request.req... | class RxDocumentClientImpl implements AsyncDocumentClient, IAuthorizationTokenProvider {
private final static ObjectMapper mapper = Utils.getSimpleObjectMapper();
private final Logger logger = LoggerFactory.getLogger(RxDocumentClientImpl.class);
private final String masterKeyOrResourceToken;
private final URI serviceEn... | class RxDocumentClientImpl implements AsyncDocumentClient, IAuthorizationTokenProvider {
private final static ObjectMapper mapper = Utils.getSimpleObjectMapper();
private final Logger logger = LoggerFactory.getLogger(RxDocumentClientImpl.class);
private final String masterKeyOrResourceToken;
private final URI serviceEn... |
Did you mean to change it from eventData2 -> eventData1? The same event data returns two different sequence values? | public void testProcessSpans() throws Exception {
final Tracer tracer1 = mock(Tracer.class);
final List<Tracer> tracers = Collections.singletonList(tracer1);
TracerProvider tracerProvider = new TracerProvider(tracers);
when(eventHubClientBuilder.buildAsyncClient()).thenReturn(eventHubAsyncClient);
when(eventHubAsyncCli... | when(eventData1.getSequenceNumber()).thenReturn(2L); | public void testProcessSpans() throws Exception {
final Tracer tracer1 = mock(Tracer.class);
final List<Tracer> tracers = Collections.singletonList(tracer1);
TracerProvider tracerProvider = new TracerProvider(tracers);
when(eventHubClientBuilder.buildAsyncClient()).thenReturn(eventHubAsyncClient);
when(eventHubAsyncCli... | class EventProcessorClientTest {
@Mock
private EventHubClientBuilder eventHubClientBuilder;
@Mock
private EventHubAsyncClient eventHubAsyncClient;
@Mock
private EventHubConsumerAsyncClient consumer1, consumer2, consumer3;
@Mock
private EventData eventData1, eventData2, eventData3, eventData4;
@BeforeEach
public void se... | class EventProcessorClientTest {
@Mock
private EventHubClientBuilder eventHubClientBuilder;
@Mock
private EventHubAsyncClient eventHubAsyncClient;
@Mock
private EventHubConsumerAsyncClient consumer1, consumer2, consumer3;
@Mock
private EventData eventData1, eventData2, eventData3, eventData4;
@BeforeEach
public void se... |
Was meaning to remove eventData2 altogether. Removed now. | public void testProcessSpans() throws Exception {
final Tracer tracer1 = mock(Tracer.class);
final List<Tracer> tracers = Collections.singletonList(tracer1);
TracerProvider tracerProvider = new TracerProvider(tracers);
when(eventHubClientBuilder.buildAsyncClient()).thenReturn(eventHubAsyncClient);
when(eventHubAsyncCli... | when(eventData1.getSequenceNumber()).thenReturn(2L); | public void testProcessSpans() throws Exception {
final Tracer tracer1 = mock(Tracer.class);
final List<Tracer> tracers = Collections.singletonList(tracer1);
TracerProvider tracerProvider = new TracerProvider(tracers);
when(eventHubClientBuilder.buildAsyncClient()).thenReturn(eventHubAsyncClient);
when(eventHubAsyncCli... | class EventProcessorClientTest {
@Mock
private EventHubClientBuilder eventHubClientBuilder;
@Mock
private EventHubAsyncClient eventHubAsyncClient;
@Mock
private EventHubConsumerAsyncClient consumer1, consumer2, consumer3;
@Mock
private EventData eventData1, eventData2, eventData3, eventData4;
@BeforeEach
public void se... | class EventProcessorClientTest {
@Mock
private EventHubClientBuilder eventHubClientBuilder;
@Mock
private EventHubAsyncClient eventHubAsyncClient;
@Mock
private EventHubConsumerAsyncClient consumer1, consumer2, consumer3;
@Mock
private EventData eventData1, eventData2, eventData3, eventData4;
@BeforeEach
public void se... |
There is a direct specification to have this as a long value. It could be directly be used as-is if kept long, maybe? >Please add enqueuedTime attribute on each link when processing messages: unix epoch time with milliseconds precision representing when message was enqueued (x-opt-enqueued-time system property). Attrib... | private void addSpanRequestAttributes(Span span, Context context, String spanName) {
Objects.requireNonNull(span, "'span' cannot be null.");
String entityPath = getOrDefault(context, ENTITY_PATH_KEY, null, String.class);
if (entityPath != null) {
span.setAttribute(MESSAGE_BUS_DESTINATION, AttributeValue.stringAttribute... | Long messageEnqueuedTime = getOrDefault(context, MESSAGE_ENQUEUED_TIME, null, Long.class); | private void addSpanRequestAttributes(Span span, Context context, String spanName) {
Objects.requireNonNull(span, "'span' cannot be null.");
String entityPath = getOrDefault(context, ENTITY_PATH_KEY, null, String.class);
if (entityPath != null) {
span.setAttribute(MESSAGE_BUS_DESTINATION, AttributeValue.stringAttribute... | class OpenTelemetryTracer implements com.azure.core.util.tracing.Tracer {
private static final Tracer TRACER = OpenTelemetry.getTracerFactory().get("Azure-OpenTelemetry");
static final String AZ_NAMESPACE_KEY = "az.namespace";
static final String MESSAGE_BUS_DESTINATION = "message_bus.destination";
static final String ... | class OpenTelemetryTracer implements com.azure.core.util.tracing.Tracer {
private static final Tracer TRACER = OpenTelemetry.getTracerFactory().get("Azure-OpenTelemetry");
static final String AZ_NAMESPACE_KEY = "az.namespace";
static final String MESSAGE_BUS_DESTINATION = "message_bus.destination";
static final String ... |
@alzimmermsft In the next month or so, we'll be deploying a service update that will set both `client-request-id` and `x-ms-client-request-id` on the response if either `return-client-request-id` or `x-ms-return-client-request-id` is specified. | public void getServiceStatsReturnsRequestId() {
SearchServiceClient serviceClient = getSearchServiceClientBuilder().buildClient();
UUID expectedUuid = UUID.randomUUID();
RequestOptions requestOptions = new RequestOptions().setClientRequestId(expectedUuid);
Response<ServiceStatistics> response = serviceClient.getService... | assertEquals(expectedUuid.toString(), response.getHeaders().getValue("client-request-id")); | public void getServiceStatsReturnsRequestId() {
SearchServiceClient serviceClient = getSearchServiceClientBuilder().buildClient();
RequestOptions requestOptions = new RequestOptions().setClientRequestId(UUID.randomUUID());
Response<ServiceStatistics> response = serviceClient.getServiceStatisticsWithResponse(requestOpti... | class SearchServiceSyncTests extends SearchServiceTestBase {
@Test
public void getServiceStatsReturnsCorrectDefinition() {
SearchServiceClient serviceClient = getSearchServiceClientBuilder().buildClient();
ServiceStatistics serviceStatistics = serviceClient.getServiceStatistics();
assertReflectionEquals(serviceStatisti... | class SearchServiceSyncTests extends SearchServiceTestBase {
@Test
public void getServiceStatsReturnsCorrectDefinition() {
SearchServiceClient serviceClient = getSearchServiceClientBuilder().buildClient();
ServiceStatistics serviceStatistics = serviceClient.getServiceStatistics();
assertReflectionEquals(serviceStatisti... |
This can now be deleted. | protected void beforeTest() {
beforeTestSetup();
client = clientSetup(pipeline -> new KeyClientBuilder()
.pipeline(pipeline)
.vaultUrl(getEndpoint())
.buildAsyncClient());
} | .buildAsyncClient()); | protected void beforeTest() {
beforeTestSetup();
} | class KeyAsyncClientTest extends KeyClientTestBase {
private KeyAsyncClient client;
@Override
private void getKeyAsyncClient(HttpClient httpClient,
KeyServiceVersion serviceVersion) {
client = clientSetup(pipeline -> new KeyClientBuilder()
.vaultUrl(getEndpoint())
.pipeline(pipeline)
.httpClient(httpClient == null ? in... | class KeyAsyncClientTest extends KeyClientTestBase {
private KeyAsyncClient client;
@Override
private void createKeyAsyncClient(HttpClient httpClient, KeyServiceVersion serviceVersion) {
HttpPipeline httpPipeline = getHttpPipeline(httpClient, serviceVersion);
client = new KeyClientBuilder()
.vaultUrl(getEndpoint())
.pi... |
This can be deleted. | protected void beforeTest() {
beforeTestSetup();
client = clientSetup(pipeline -> new KeyClientBuilder()
.vaultUrl(getEndpoint())
.pipeline(pipeline)
.buildClient());
} | .buildClient()); | protected void beforeTest() {
beforeTestSetup();
} | class KeyClientTest extends KeyClientTestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private KeyClient client;
@Override
private void getKeyClient(HttpClient httpClient,
KeyServiceVersion serviceVersion) {
client = clientSetup(pipeline -> new KeyClientBuilder()
.vaultUrl... | class KeyClientTest extends KeyClientTestBase {
private KeyClient client;
@Override
private void getKeyClient(HttpClient httpClient, KeyServiceVersion serviceVersion) {
HttpPipeline httpPipeline = getHttpPipeline(httpClient, serviceVersion);
client = new KeyClientBuilder()
.vaultUrl(getEndpoint())
.pipeline(httpPipelin... |
The service version should be set on the builder otherwise it will always use the latest. | private void getKeyClient(HttpClient httpClient, KeyServiceVersion serviceVersion) {
HttpPipeline httpPipeline = getHttpPipeline(httpClient, serviceVersion);
client = new KeyClientBuilder()
.vaultUrl(getEndpoint())
.pipeline(httpPipeline)
.buildClient();
} | .buildClient(); | private void getKeyClient(HttpClient httpClient, KeyServiceVersion serviceVersion) {
HttpPipeline httpPipeline = getHttpPipeline(httpClient, serviceVersion);
client = new KeyClientBuilder()
.vaultUrl(getEndpoint())
.pipeline(httpPipeline)
.serviceVersion(serviceVersion)
.buildClient();
} | class KeyClientTest extends KeyClientTestBase {
private KeyClient client;
@Override
protected void beforeTest() {
beforeTestSetup();
}
/**
* Tests that a key can be created in the key vault.
*/
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getTestParameters")
public void setKey(HttpClient httpCl... | class KeyClientTest extends KeyClientTestBase {
private KeyClient client;
@Override
protected void beforeTest() {
beforeTestSetup();
}
/**
* Tests that a key can be created in the key vault.
*/
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getTestParameters")
public void setKey(HttpClient httpCl... |
Why's getCertificateClient() called twice? | public void createCertificate(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
getCertificateClient(httpClient, serviceVersion);
createCertificateRunner((policy) -> {
getCertificateClient(httpClient, serviceVersion);
String certName = generateResourceId("testCer");
SyncPoller<CertificateOperation, Key... | getCertificateClient(httpClient, serviceVersion); | public void createCertificate(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
createCertificateClient(httpClient, serviceVersion);
createCertificateRunner((policy) -> {
String certName = generateResourceId("testCer");
SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = client... | class CertificateClientTest extends CertificateClientTestBase {
private CertificateClient client;
@Override
protected void beforeTest() {
beforeTestSetup();
}
private void getCertificateClient(HttpClient httpClient,
CertificateServiceVersion serviceVersion) {
HttpPipeline httpPipeline = getHttpPipeline(httpClient, serv... | class CertificateClientTest extends CertificateClientTestBase {
private CertificateClient client;
@Override
protected void beforeTest() {
beforeTestSetup();
}
private void createCertificateClient(HttpClient httpClient,
CertificateServiceVersion serviceVersion) {
HttpPipeline httpPipeline = getHttpPipeline(httpClient, s... |
nit: delete this line | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
@Override
protected String getTestName() {
return "";
}
void beforeTe... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
private static final String AZURE_KEYVAULT_TEST_CERTIFICATE_SERVICE_V... | |
This should check the environment variable before returning true. | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | return true; | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
@Override
protected String getTestName() {
return "";
}
void beforeTe... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
private static final String AZURE_KEYVAULT_TEST_CERTIFICATE_SERVICE_V... |
The file name was changed. Was this intended? | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | byte[] certificateContent = readCertificate("certificate.pem"); | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
@Override
protected String getTestName() {
return "";
}
void beforeTe... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
private static final String AZURE_KEYVAULT_TEST_CERTIFICATE_SERVICE_V... |
Why was this change required? | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | pemPath = pemPath.substring(1); | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
@Override
protected String getTestName() {
return "";
}
void beforeTe... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
private static final String AZURE_KEYVAULT_TEST_CERTIFICATE_SERVICE_V... |
Paste error. Removed. | public void createCertificate(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
getCertificateClient(httpClient, serviceVersion);
createCertificateRunner((policy) -> {
getCertificateClient(httpClient, serviceVersion);
String certName = generateResourceId("testCer");
SyncPoller<CertificateOperation, Key... | getCertificateClient(httpClient, serviceVersion); | public void createCertificate(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
createCertificateClient(httpClient, serviceVersion);
createCertificateRunner((policy) -> {
String certName = generateResourceId("testCer");
SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = client... | class CertificateClientTest extends CertificateClientTestBase {
private CertificateClient client;
@Override
protected void beforeTest() {
beforeTestSetup();
}
private void getCertificateClient(HttpClient httpClient,
CertificateServiceVersion serviceVersion) {
HttpPipeline httpPipeline = getHttpPipeline(httpClient, serv... | class CertificateClientTest extends CertificateClientTestBase {
private CertificateClient client;
@Override
protected void beforeTest() {
beforeTestSetup();
}
private void createCertificateClient(HttpClient httpClient,
CertificateServiceVersion serviceVersion) {
HttpPipeline httpPipeline = getHttpPipeline(httpClient, s... |
This is merge issue. Thanks for catching this. | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | byte[] certificateContent = readCertificate("certificate.pem"); | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
@Override
protected String getTestName() {
return "";
}
void beforeTe... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
private static final String AZURE_KEYVAULT_TEST_CERTIFICATE_SERVICE_V... |
Not merge the most recent. Changed to master one. | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | pemPath = pemPath.substring(1); | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
@Override
protected String getTestName() {
return "";
}
void beforeTe... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
private static final String AZURE_KEYVAULT_TEST_CERTIFICATE_SERVICE_V... |
Added a nullcheck | public IdentityClientOptions setTokenRefreshOffset(Duration tokenRefreshOffset) {
this.tokenRefreshOffset = tokenRefreshOffset;
return this;
} | this.tokenRefreshOffset = tokenRefreshOffset; | public IdentityClientOptions setTokenRefreshOffset(Duration tokenRefreshOffset) {
if (tokenRefreshOffset != null) {
this.tokenRefreshOffset = tokenRefreshOffset;
}
return this;
} | class IdentityClientOptions {
private static final String DEFAULT_AUTHORITY_HOST = "https:
private static final int MAX_RETRY_DEFAULT_LIMIT = 3;
private String authorityHost;
private int maxRetry;
private Function<Duration, Duration> retryTimeout;
private ProxyOptions proxyOptions;
private HttpPipeline httpPipeline;
pr... | class IdentityClientOptions {
private static final String DEFAULT_AUTHORITY_HOST = "https:
private static final int MAX_RETRY_DEFAULT_LIMIT = 3;
private String authorityHost;
private int maxRetry;
private Function<Duration, Duration> retryTimeout;
private ProxyOptions proxyOptions;
private HttpPipeline httpPipeline;
pr... |
This should be updated too. | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | return true; | HttpPipeline getHttpPipeline(HttpClient httpClient, CertificateServiceVersion serviceVersion) {
TokenCredential credential = null;
if (!interceptorManager.isPlaybackMode()) {
String clientId = System.getenv("ARM_CLIENTID");
String clientKey = System.getenv("ARM_CLIENTKEY");
String tenantId = System.getenv("AZURE_TENANT... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
@Override
protected String getTestName() {
return "";
}
void beforeTe... | class CertificateClientTestBase extends TestBase {
static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private static final String SDK_NAME = "client_name";
private static final String SDK_VERSION = "client_version";
private static final String AZURE_KEYVAULT_TEST_CERTIFICATE_SERVICE_V... |
Here we need to validate the scope passed in doesn't contain any characters which could cause us to execute something unintended. See https://github.com/Azure/azure-sdk-for-net/blob/23cc9455cf501d6a65ce8faaedb27242b27c3b51/sdk/identity/Azure.Identity/src/ScopeUtilities.cs#L46-L54 | public Mono<AccessToken> authenticateWithAzureCli(TokenRequestContext request) {
String azCommand = "az account get-access-token --output json --resource ";
StringBuilder command = new StringBuilder();
command.append(azCommand);
String scopes = ScopeUtil.scopesToResource(request.getScopes());
command.append(scopes);
Ac... | command.append(scopes); | public Mono<AccessToken> authenticateWithAzureCli(TokenRequestContext request) {
String azCommand = "az account get-access-token --output json --resource ";
StringBuilder command = new StringBuilder();
command.append(azCommand);
String scopes = ScopeUtil.scopesToResource(request.getScopes());
try {
ScopeUtil.validateSc... | class IdentityClient {
private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter();
private static final Random RANDOM = new Random();
private static final String WINDOWS_STARTER = "cmd.exe";
private static final String LINUX_MAC_STARTER = "/bin/sh";
private static final ... | class IdentityClient {
private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter();
private static final Random RANDOM = new Random();
private static final String WINDOWS_STARTER = "cmd.exe";
private static final String LINUX_MAC_STARTER = "/bin/sh";
private static final ... |
Put null checking in method at the first place. | public ScoringParameter(String name, GeoPoint value) {
this(name, toLonLatStrings(value));
} | this(name, toLonLatStrings(value)); | public ScoringParameter(String name, GeoPoint value) {
this(name, toLonLatStrings(value));
} | class with the given name and GeographyPoint value.
*
* @param name Name of the scoring parameter.
* @param value Value of the scoring parameter.
*/ | class with the given name and GeographyPoint value.
*
* @param name Name of the scoring parameter.
* @param value Value of the scoring parameter.
*/ |
Reverts the minus 2 minutes in AccessToken: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core/src/main/java/com/azure/core/credential/AccessToken.java#L22 | public MsalToken(IAuthenticationResult msalResult, IdentityClientOptions options) {
super(msalResult.accessToken(), OffsetDateTime.ofInstant(
msalResult.expiresOnDate().toInstant().minus(options.getRefreshBeforeExpiry()), ZoneOffset.UTC)
.plusMinutes(2));
this.account = msalResult.account();
} | .plusMinutes(2)); | public MsalToken(IAuthenticationResult msalResult, IdentityClientOptions options) {
super(msalResult.accessToken(),
OffsetDateTime.ofInstant(msalResult.expiresOnDate().toInstant(), ZoneOffset.UTC),
options);
this.account = msalResult.account();
} | class MsalToken extends AccessToken {
private IAccount account;
/**
* Creates an access token instance.
*
* @param msalResult the raw authentication result returned by MSAL
*/
/**
* @return the signed in account
*/
public IAccount getAccount() {
return account;
}
} | class MsalToken extends IdentityToken {
private IAccount account;
/**
* Creates an access token instance.
*
* @param msalResult the raw authentication result returned by MSAL
*/
/**
* @return the signed in account
*/
public IAccount getAccount() {
return account;
}
} |
There is duplicate code here and above for creating the `AccessToken`, which is a possible source of bugs in the future if they are not kept in sync. Consider creating a method to centralise it. | public Mono<AccessToken> authenticateToIMDSEndpoint(TokenRequestContext request) {
String resource = ScopeUtil.scopesToResource(request.getScopes());
StringBuilder payload = new StringBuilder();
final int imdsUpgradeTimeInMs = 70 * 1000;
try {
payload.append("api-version=");
payload.append(URLEncoder.encode("2018-02-01... | msiToken.getExpiresAt().plusMinutes(2).minus(options.getRefreshBeforeExpiry())); | public Mono<AccessToken> authenticateToIMDSEndpoint(TokenRequestContext request) {
String resource = ScopeUtil.scopesToResource(request.getScopes());
StringBuilder payload = new StringBuilder();
final int imdsUpgradeTimeInMs = 70 * 1000;
try {
payload.append("api-version=");
payload.append(URLEncoder.encode("2018-02-01... | class IdentityClient {
private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter();
private static final Random RANDOM = new Random();
private final ClientLogger logger = new ClientLogger(IdentityClient.class);
private final IdentityClientOptions options;
private final Pu... | class IdentityClient {
private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter();
private static final Random RANDOM = new Random();
private final ClientLogger logger = new ClientLogger(IdentityClient.class);
private final IdentityClientOptions options;
private final Pu... |
I feel like we are spreading the two minute concept out throughout the code base. Can you have it as a private static final value that is referred to everywhere? | public MsalToken(IAuthenticationResult msalResult, IdentityClientOptions options) {
super(msalResult.accessToken(), OffsetDateTime.ofInstant(
msalResult.expiresOnDate().toInstant().minus(options.getRefreshBeforeExpiry()), ZoneOffset.UTC)
.plusMinutes(2));
this.account = msalResult.account();
} | .plusMinutes(2)); | public MsalToken(IAuthenticationResult msalResult, IdentityClientOptions options) {
super(msalResult.accessToken(),
OffsetDateTime.ofInstant(msalResult.expiresOnDate().toInstant(), ZoneOffset.UTC),
options);
this.account = msalResult.account();
} | class MsalToken extends AccessToken {
private IAccount account;
/**
* Creates an access token instance.
*
* @param msalResult the raw authentication result returned by MSAL
*/
/**
* @return the signed in account
*/
public IAccount getAccount() {
return account;
}
} | class MsalToken extends IdentityToken {
private IAccount account;
/**
* Creates an access token instance.
*
* @param msalResult the raw authentication result returned by MSAL
*/
/**
* @return the signed in account
*/
public IAccount getAccount() {
return account;
}
} |
Moved to a common base class IdentityToken | public Mono<AccessToken> authenticateToIMDSEndpoint(TokenRequestContext request) {
String resource = ScopeUtil.scopesToResource(request.getScopes());
StringBuilder payload = new StringBuilder();
final int imdsUpgradeTimeInMs = 70 * 1000;
try {
payload.append("api-version=");
payload.append(URLEncoder.encode("2018-02-01... | msiToken.getExpiresAt().plusMinutes(2).minus(options.getRefreshBeforeExpiry())); | public Mono<AccessToken> authenticateToIMDSEndpoint(TokenRequestContext request) {
String resource = ScopeUtil.scopesToResource(request.getScopes());
StringBuilder payload = new StringBuilder();
final int imdsUpgradeTimeInMs = 70 * 1000;
try {
payload.append("api-version=");
payload.append(URLEncoder.encode("2018-02-01... | class IdentityClient {
private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter();
private static final Random RANDOM = new Random();
private final ClientLogger logger = new ClientLogger(IdentityClient.class);
private final IdentityClientOptions options;
private final Pu... | class IdentityClient {
private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter();
private static final Random RANDOM = new Random();
private final ClientLogger logger = new ClientLogger(IdentityClient.class);
private final IdentityClientOptions options;
private final Pu... |
nit; `null` check. | public IdentityClientOptions setTokenRefreshOffset(Duration tokenRefreshOffset) {
this.tokenRefreshOffset = tokenRefreshOffset;
return this;
} | this.tokenRefreshOffset = tokenRefreshOffset; | public IdentityClientOptions setTokenRefreshOffset(Duration tokenRefreshOffset) {
if (tokenRefreshOffset != null) {
this.tokenRefreshOffset = tokenRefreshOffset;
}
return this;
} | class IdentityClientOptions {
private static final String DEFAULT_AUTHORITY_HOST = "https:
private static final int MAX_RETRY_DEFAULT_LIMIT = 3;
private String authorityHost;
private int maxRetry;
private Function<Duration, Duration> retryTimeout;
private ProxyOptions proxyOptions;
private HttpPipeline httpPipeline;
pr... | class IdentityClientOptions {
private static final String DEFAULT_AUTHORITY_HOST = "https:
private static final int MAX_RETRY_DEFAULT_LIMIT = 3;
private String authorityHost;
private int maxRetry;
private Function<Duration, Duration> retryTimeout;
private ProxyOptions proxyOptions;
private HttpPipeline httpPipeline;
pr... |
Along with the other comment, this property name could be changed to be more generic. | public HttpLoggingPolicy(HttpLogOptions httpLogOptions) {
if (httpLogOptions == null) {
this.httpLogDetailLevel = HttpLogDetailLevel.NONE;
this.allowedHeaderNames = Collections.emptySet();
this.allowedQueryParameterNames = Collections.emptySet();
this.prettyPrintJson = false;
} else {
this.httpLogDetailLevel = httpLogO... | this.prettyPrintJson = false; | public HttpLoggingPolicy(HttpLogOptions httpLogOptions) {
if (httpLogOptions == null) {
this.httpLogDetailLevel = HttpLogDetailLevel.NONE;
this.allowedHeaderNames = Collections.emptySet();
this.allowedQueryParameterNames = Collections.emptySet();
this.prettyPrintBody = false;
} else {
this.httpLogDetailLevel = httpLogO... | class HttpLoggingPolicy implements HttpPipelinePolicy {
private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
private static final int MAX_BODY_LOG_SIZE = 1024 * 16;
private static final String REDACTED_PLACEHOLDER = "REDACTED";
private final HttpLogDetailLeve... | class HttpLoggingPolicy implements HttpPipelinePolicy {
private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
private static final int MAX_BODY_LOG_SIZE = 1024 * 16;
private static final String REDACTED_PLACEHOLDER = "REDACTED";
private final HttpLogDetailLeve... |
Renamed this property as well. | public HttpLoggingPolicy(HttpLogOptions httpLogOptions) {
if (httpLogOptions == null) {
this.httpLogDetailLevel = HttpLogDetailLevel.NONE;
this.allowedHeaderNames = Collections.emptySet();
this.allowedQueryParameterNames = Collections.emptySet();
this.prettyPrintJson = false;
} else {
this.httpLogDetailLevel = httpLogO... | this.prettyPrintJson = false; | public HttpLoggingPolicy(HttpLogOptions httpLogOptions) {
if (httpLogOptions == null) {
this.httpLogDetailLevel = HttpLogDetailLevel.NONE;
this.allowedHeaderNames = Collections.emptySet();
this.allowedQueryParameterNames = Collections.emptySet();
this.prettyPrintBody = false;
} else {
this.httpLogDetailLevel = httpLogO... | class HttpLoggingPolicy implements HttpPipelinePolicy {
private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
private static final int MAX_BODY_LOG_SIZE = 1024 * 16;
private static final String REDACTED_PLACEHOLDER = "REDACTED";
private final HttpLogDetailLeve... | class HttpLoggingPolicy implements HttpPipelinePolicy {
private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
private static final int MAX_BODY_LOG_SIZE = 1024 * 16;
private static final String REDACTED_PLACEHOLDER = "REDACTED";
private final HttpLogDetailLeve... |
So the `retryCount` is global for the `Download` not per `read()` invocation? | private Flux<ByteBuffer> tryContinueFlux(Throwable t, int retryCount, DownloadRetryOptions options) {
if (retryCount >= options.getMaxRetryRequests()
|| !(t instanceof IOException || t instanceof TimeoutException)) {
return Flux.error(t);
} else {
/*
We wrap this in a try catch because we don't know the behavior of the... | if (retryCount >= options.getMaxRetryRequests() | private Flux<ByteBuffer> tryContinueFlux(Throwable t, int retryCount, DownloadRetryOptions options) {
if (retryCount >= options.getMaxRetryRequests()
|| !(t instanceof IOException || t instanceof TimeoutException)) {
return Flux.error(t);
} else {
/*
We wrap this in a try catch because we don't know the behavior of the... | class ReliableDownload {
private static final Duration TIMEOUT_VALUE = Duration.ofSeconds(60);
private final BlobsDownloadResponse rawResponse;
private final DownloadRetryOptions options;
private final HttpGetterInfo info;
private final Function<HttpGetterInfo, Mono<ReliableDownload>> getter;
ReliableDownload(BlobsDown... | class ReliableDownload {
private static final Duration TIMEOUT_VALUE = Duration.ofSeconds(60);
private final BlobsDownloadResponse rawResponse;
private final DownloadRetryOptions options;
private final HttpGetterInfo info;
private final Function<HttpGetterInfo, Mono<ReliableDownload>> getter;
ReliableDownload(BlobsDown... |
It is as I've coded it here. I picked this a little bit arbitrarily. Since this was easier/faster and both of us seemed a little unsure that one option was strictly better than the other, I figured sticking with the existing plan would make it more likely to be ready to ship next week. We also see these stale streams p... | private Flux<ByteBuffer> tryContinueFlux(Throwable t, int retryCount, DownloadRetryOptions options) {
if (retryCount >= options.getMaxRetryRequests()
|| !(t instanceof IOException || t instanceof TimeoutException)) {
return Flux.error(t);
} else {
/*
We wrap this in a try catch because we don't know the behavior of the... | if (retryCount >= options.getMaxRetryRequests() | private Flux<ByteBuffer> tryContinueFlux(Throwable t, int retryCount, DownloadRetryOptions options) {
if (retryCount >= options.getMaxRetryRequests()
|| !(t instanceof IOException || t instanceof TimeoutException)) {
return Flux.error(t);
} else {
/*
We wrap this in a try catch because we don't know the behavior of the... | class ReliableDownload {
private static final Duration TIMEOUT_VALUE = Duration.ofSeconds(60);
private final BlobsDownloadResponse rawResponse;
private final DownloadRetryOptions options;
private final HttpGetterInfo info;
private final Function<HttpGetterInfo, Mono<ReliableDownload>> getter;
ReliableDownload(BlobsDown... | class ReliableDownload {
private static final Duration TIMEOUT_VALUE = Duration.ofSeconds(60);
private final BlobsDownloadResponse rawResponse;
private final DownloadRetryOptions options;
private final HttpGetterInfo info;
private final Function<HttpGetterInfo, Mono<ReliableDownload>> getter;
ReliableDownload(BlobsDown... |
sounds good. | private Flux<ByteBuffer> tryContinueFlux(Throwable t, int retryCount, DownloadRetryOptions options) {
if (retryCount >= options.getMaxRetryRequests()
|| !(t instanceof IOException || t instanceof TimeoutException)) {
return Flux.error(t);
} else {
/*
We wrap this in a try catch because we don't know the behavior of the... | if (retryCount >= options.getMaxRetryRequests() | private Flux<ByteBuffer> tryContinueFlux(Throwable t, int retryCount, DownloadRetryOptions options) {
if (retryCount >= options.getMaxRetryRequests()
|| !(t instanceof IOException || t instanceof TimeoutException)) {
return Flux.error(t);
} else {
/*
We wrap this in a try catch because we don't know the behavior of the... | class ReliableDownload {
private static final Duration TIMEOUT_VALUE = Duration.ofSeconds(60);
private final BlobsDownloadResponse rawResponse;
private final DownloadRetryOptions options;
private final HttpGetterInfo info;
private final Function<HttpGetterInfo, Mono<ReliableDownload>> getter;
ReliableDownload(BlobsDown... | class ReliableDownload {
private static final Duration TIMEOUT_VALUE = Duration.ofSeconds(60);
private final BlobsDownloadResponse rawResponse;
private final DownloadRetryOptions options;
private final HttpGetterInfo info;
private final Function<HttpGetterInfo, Mono<ReliableDownload>> getter;
ReliableDownload(BlobsDown... |
Can we check to ensure one isn't already present? I suppose it wouldn't matter because we remove the encryption metadata, so it wouldn't double decrypt, but it's probably safer if we check. | public EncryptedBlobClientBuilder pipeline(HttpPipeline httpPipeline) {
if (this.httpPipeline != null && httpPipeline == null) {
logger.info("HttpPipeline is being set to 'null' when it was previously configured.");
}
checkValidEncryptionParameters();
HttpPipeline pipeline = null;
if (httpPipeline != null) {
List<HttpP... | for (int i = 0; i < httpPipeline.getPolicyCount(); i++) { | public EncryptedBlobClientBuilder pipeline(HttpPipeline httpPipeline) {
if (this.httpPipeline != null && httpPipeline == null) {
logger.info("HttpPipeline is being set to 'null' when it was previously configured.");
}
checkValidEncryptionParameters();
HttpPipeline pipeline = null;
if (httpPipeline != null) {
List<HttpP... | class EncryptedBlobClientBuilder {
private final ClientLogger logger = new ClientLogger(EncryptedBlobClientBuilder.class);
private static final String SDK_NAME = "name";
private static final String SDK_VERSION = "version";
private String endpoint;
private String accountName;
private String containerName;
private String... | class EncryptedBlobClientBuilder {
private final ClientLogger logger = new ClientLogger(EncryptedBlobClientBuilder.class);
private static final String SDK_NAME = "name";
private static final String SDK_VERSION = "version";
private String endpoint;
private String accountName;
private String containerName;
private String... |
will do | public EncryptedBlobClientBuilder pipeline(HttpPipeline httpPipeline) {
if (this.httpPipeline != null && httpPipeline == null) {
logger.info("HttpPipeline is being set to 'null' when it was previously configured.");
}
checkValidEncryptionParameters();
HttpPipeline pipeline = null;
if (httpPipeline != null) {
List<HttpP... | for (int i = 0; i < httpPipeline.getPolicyCount(); i++) { | public EncryptedBlobClientBuilder pipeline(HttpPipeline httpPipeline) {
if (this.httpPipeline != null && httpPipeline == null) {
logger.info("HttpPipeline is being set to 'null' when it was previously configured.");
}
checkValidEncryptionParameters();
HttpPipeline pipeline = null;
if (httpPipeline != null) {
List<HttpP... | class EncryptedBlobClientBuilder {
private final ClientLogger logger = new ClientLogger(EncryptedBlobClientBuilder.class);
private static final String SDK_NAME = "name";
private static final String SDK_VERSION = "version";
private String endpoint;
private String accountName;
private String containerName;
private String... | class EncryptedBlobClientBuilder {
private final ClientLogger logger = new ClientLogger(EncryptedBlobClientBuilder.class);
private static final String SDK_NAME = "name";
private static final String SDK_VERSION = "version";
private String endpoint;
private String accountName;
private String containerName;
private String... |
Oops! | BlobClient toBlobClient() throws IOException {
Path root = this.normalize().toAbsolutePath().getRoot();
if (root == null) {
throw Utility.logError(logger,
new IllegalStateException("Root should never be null after calling toAbsolutePath."));
}
String fileStoreName = this.rootToFileStore(root.toString());
BlobContainerC... | <<<<<<< HEAD | BlobClient toBlobClient() throws IOException {
Path root = this.normalize().toAbsolutePath().getRoot();
if (root == null) {
throw Utility.logError(logger,
new IllegalStateException("Root should never be null after calling toAbsolutePath."));
}
String fileStoreName = this.rootToFileStore(root.toString());
BlobContainerC... | class AzurePath implements Path {
private final ClientLogger logger = new ClientLogger(AzurePath.class);
static final String ROOT_DIR_SUFFIX = ":";
private final AzureFileSystem parentFileSystem;
private final String pathString;
AzurePath(AzureFileSystem parentFileSystem, String first, String... more) {
this.parentFile... | class AzurePath implements Path {
private final ClientLogger logger = new ClientLogger(AzurePath.class);
static final String ROOT_DIR_SUFFIX = ":";
private final AzureFileSystem parentFileSystem;
private final String pathString;
AzurePath(AzureFileSystem parentFileSystem, String first, String... more) {
this.parentFile... |
Do we want to log and throw an exception if the exception is that the blob doesn't exist? I'm good with either, just a theoretical question on what delete on something that doesn't exist means. | public void delete(Path path) throws IOException {
AzurePath aPath = validatePathInstanceType(path);
validateNotRoot(path, "Delete");
BlobClient blobClient = aPath.toBlobClient();
DirectoryStatus dirStatus = checkDirStatus(blobClient);
if (dirStatus.equals(DirectoryStatus.DOES_NOT_EXIST)) {
throw Utility.logError(logge... | throw Utility.logError(logger, new IOException(e)); | public void delete(Path path) throws IOException {
AzurePath aPath = validatePathInstanceType(path);
validateNotRoot(path, "Delete");
BlobClient blobClient = aPath.toBlobClient();
DirectoryStatus dirStatus = checkDirStatus(blobClient);
if (dirStatus.equals(DirectoryStatus.DOES_NOT_EXIST)) {
throw Utility.logError(logge... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... |
seems cachedpage removed, any concern on performance etc when original cachedpage adding? Or we may revisit it later when there's complain | protected void loadNextPage() {
this.items.addAll(pagedResponseIterator.next().getValue());
} | this.items.addAll(pagedResponseIterator.next().getValue()); | protected void loadNextPage() {
this.items.addAll(pagedResponseIterator.next().getValue());
} | class PagedList<E> implements List<E> {
/** The items retrieved. */
private final List<E> items;
/** The paged response iterator for not retrieved items. */
private Iterator<PagedResponse<E>> pagedResponseIterator;
/**
* Creates an instance of PagedList.
*/
public PagedList() {
items = new ArrayList<>();
pagedResponseI... | class PagedList<E> implements List<E> {
/** The items retrieved. */
private final List<E> items;
/** The paged response iterator for not retrieved items. */
private Iterator<PagedResponse<E>> pagedResponseIterator;
/**
* Creates an instance of PagedList.
*/
public PagedList() {
items = new ArrayList<>();
pagedResponseI... |
Won't checkDirStatus do the blob doesn't exist validation for us? It gets the container client and lists paths with path = blob name and returns diff codes depending on the number of elements underneath it | public void delete(Path path) throws IOException {
AzurePath aPath = validatePathInstanceType(path);
validateNotRoot(path, "Delete");
BlobClient blobClient = aPath.toBlobClient();
DirectoryStatus dirStatus = checkDirStatus(blobClient);
if (dirStatus.equals(DirectoryStatus.DOES_NOT_EXIST)) {
throw Utility.logError(logge... | throw Utility.logError(logger, new IOException(e)); | public void delete(Path path) throws IOException {
AzurePath aPath = validatePathInstanceType(path);
validateNotRoot(path, "Delete");
BlobClient blobClient = aPath.toBlobClient();
DirectoryStatus dirStatus = checkDirStatus(blobClient);
if (dirStatus.equals(DirectoryStatus.DOES_NOT_EXIST)) {
throw Utility.logError(logge... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... |
I suppose something could also happen between that check and the delete | public void delete(Path path) throws IOException {
AzurePath aPath = validatePathInstanceType(path);
validateNotRoot(path, "Delete");
BlobClient blobClient = aPath.toBlobClient();
DirectoryStatus dirStatus = checkDirStatus(blobClient);
if (dirStatus.equals(DirectoryStatus.DOES_NOT_EXIST)) {
throw Utility.logError(logge... | throw Utility.logError(logger, new IOException(e)); | public void delete(Path path) throws IOException {
AzurePath aPath = validatePathInstanceType(path);
validateNotRoot(path, "Delete");
BlobClient blobClient = aPath.toBlobClient();
DirectoryStatus dirStatus = checkDirStatus(blobClient);
if (dirStatus.equals(DirectoryStatus.DOES_NOT_EXIST)) {
throw Utility.logError(logge... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... |
It's true we do check for no such blob based on the dir status earlier and also true that something else could happen in between. I added a specific case for a BlobNotFound error code and throw a NoSuchFileException in that case as well. I would prefer to throw in the case of no such file because the docs say we can,... | public void delete(Path path) throws IOException {
AzurePath aPath = validatePathInstanceType(path);
validateNotRoot(path, "Delete");
BlobClient blobClient = aPath.toBlobClient();
DirectoryStatus dirStatus = checkDirStatus(blobClient);
if (dirStatus.equals(DirectoryStatus.DOES_NOT_EXIST)) {
throw Utility.logError(logge... | throw Utility.logError(logger, new IOException(e)); | public void delete(Path path) throws IOException {
AzurePath aPath = validatePathInstanceType(path);
validateNotRoot(path, "Delete");
BlobClient blobClient = aPath.toBlobClient();
DirectoryStatus dirStatus = checkDirStatus(blobClient);
if (dirStatus.equals(DirectoryStatus.DOES_NOT_EXIST)) {
throw Utility.logError(logge... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... | class AzureFileSystemProvider extends FileSystemProvider {
private final ClientLogger logger = new ClientLogger(AzureFileSystemProvider.class);
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_DISPOSITION = "Content-Disposition";
public static final String CONTENT_LANGUAGE = ... |
use logger please | public void generateTestData() {
Random rand = new Random();
ObjectMapper mapper = new ObjectMapper();
for (int i = 0; i < 40; i++) {
Person person = getRandomPerson(rand);
try {
docs.add(new CosmosItemProperties(mapper.writeValueAsString(person)));
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
} | e.printStackTrace(); | public void generateTestData() {
Random rand = new Random();
ObjectMapper mapper = new ObjectMapper();
for (int i = 0; i < 40; i++) {
Person person = getRandomPerson(rand);
try {
docs.add(new CosmosItemProperties(mapper.writeValueAsString(person)));
} catch (JsonProcessingException e) {
logger.error(e.getMessage());
}
... | class DistinctQueryTests extends TestSuiteBase {
private final String FIELD = "name";
private CosmosAsyncContainer createdCollection;
private ArrayList<CosmosItemProperties> docs = new ArrayList<>();
private CosmosAsyncClient client;
@Factory(dataProvider = "clientBuilders")
public DistinctQueryTests(CosmosClientBuilde... | class DistinctQueryTests extends TestSuiteBase {
private final int TIMEOUT_120 = 120000;
private final String FIELD = "name";
private CosmosAsyncContainer createdCollection;
private ArrayList<CosmosItemProperties> docs = new ArrayList<>();
private CosmosAsyncClient client;
@Factory(dataProvider = "clientBuildersWithDir... |
ObjectMapper instantiation is expensive. you should have a static ObjectMapper instead: `OrderedDistinctMap.OBJECT_MAPPER` | public OrderedDistinctMap(String lastHash) {
mapper = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
this.lastHash = lastHash;
} | mapper = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); | public OrderedDistinctMap(String lastHash) {
this.lastHash = lastHash;
} | class OrderedDistinctMap extends DistinctMap {
private final ObjectMapper mapper;
private String lastHash;
@Override
public boolean add(Object resource, Utils.ValueHolder<String> outHash) {
try {
String sortedJson = mapper.writeValueAsString(resource);
MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] diges... | class OrderedDistinctMap extends DistinctMap {
private volatile String lastHash;
@Override
public boolean add(Resource resource, Utils.ValueHolder<String> outHash) {
try {
outHash.v = getHash(resource);
final boolean value = !StringUtils.equals(lastHash, outHash.v);
lastHash = outHash.v;
return value;
} catch (JsonProc... |
ditto, ObjectMapper instantiation is expensive. we should use a static one. You can create here `UnorderedDistinctMap.OBJECT_MAMMER` | public UnorderedDistinctMap() {
resultSet = new HashSet<>();
mapper = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
} | mapper = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); | public UnorderedDistinctMap() {
resultSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
} | class UnorderedDistinctMap extends DistinctMap {
private final ObjectMapper mapper;
private final HashSet<String> resultSet;
@Override
public boolean add(Object resource, Utils.ValueHolder<String> outHash) {
try {
String sortedJson = mapper.writeValueAsString(resource);
MessageDigest md = MessageDigest.getInstance("SHA... | class UnorderedDistinctMap extends DistinctMap {
private final Set<String> resultSet;
@Override
public boolean add(Resource resource, Utils.ValueHolder<String> outHash) {
try {
outHash.v = getHash(resource);
return resultSet.add(outHash.v);
} catch (JsonProcessingException | NoSuchAlgorithmException e) {
throw new Ille... |
This should be `false` right? since the ordering does not change the hash. | public void objectOrder(DistinctQueryType queryType) {
String resource1 = String.format("{ "
+ "\"id\": \"12345\", "
+ "\"mypk\": \"abcde\""
+ "} ");
String resource2 = String.format("{ "
+ "\"mypk\": \"abcde\","
+ "\"id\": \"12345\""
+ "} ");
DistinctMap distinctMap = DistinctMap.create(queryType, null);
Utils.ValueHo... | assertThat(add2).as("Order of objects in map should be treated same").isTrue(); | public void objectOrder(DistinctQueryType queryType) {
String resource1 = String.format("{ "
+ "\"id\": \"12345\","
+ "\"mypk\": \"abcde\""
+ "} ");
String resource2 = String.format("{ "
+ "\"mypk\": \"abcde\","
+ "\"id\": \"12345\""
+ "} ");
Document resource = new Document(resource1);
DistinctMap distinctMap = Distin... | class DistinctMapTest {
@DataProvider(name = "distinctMapArgProvider")
public Object[][] distinctMapArgProvider() {
return new Object[][] {
{DistinctQueryType.Ordered},
{DistinctQueryType.Unordered},
};
}
@Test(groups = "unit", dataProvider = "distinctMapArgProvider")
public void integerValue(DistinctQueryType queryTyp... | class DistinctMapTest {
@DataProvider(name = "distinctMapArgProvider")
public Object[][] distinctMapArgProvider() {
return new Object[][] {
{DistinctQueryType.ORDERED},
{DistinctQueryType.UNORDERED},
};
}
@Test(groups = "unit", dataProvider = "distinctMapArgProvider")
public void integerValue(DistinctQueryType queryTyp... |
Done | public OrderedDistinctMap(String lastHash) {
mapper = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
this.lastHash = lastHash;
} | mapper = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); | public OrderedDistinctMap(String lastHash) {
this.lastHash = lastHash;
} | class OrderedDistinctMap extends DistinctMap {
private final ObjectMapper mapper;
private String lastHash;
@Override
public boolean add(Object resource, Utils.ValueHolder<String> outHash) {
try {
String sortedJson = mapper.writeValueAsString(resource);
MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] diges... | class OrderedDistinctMap extends DistinctMap {
private volatile String lastHash;
@Override
public boolean add(Resource resource, Utils.ValueHolder<String> outHash) {
try {
outHash.v = getHash(resource);
final boolean value = !StringUtils.equals(lastHash, outHash.v);
lastHash = outHash.v;
return value;
} catch (JsonProc... |
Done | public UnorderedDistinctMap() {
resultSet = new HashSet<>();
mapper = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
} | mapper = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); | public UnorderedDistinctMap() {
resultSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
} | class UnorderedDistinctMap extends DistinctMap {
private final ObjectMapper mapper;
private final HashSet<String> resultSet;
@Override
public boolean add(Object resource, Utils.ValueHolder<String> outHash) {
try {
String sortedJson = mapper.writeValueAsString(resource);
MessageDigest md = MessageDigest.getInstance("SHA... | class UnorderedDistinctMap extends DistinctMap {
private final Set<String> resultSet;
@Override
public boolean add(Resource resource, Utils.ValueHolder<String> outHash) {
try {
outHash.v = getHash(resource);
return resultSet.add(outHash.v);
} catch (JsonProcessingException | NoSuchAlgorithmException e) {
throw new Ille... |
Done | public void generateTestData() {
Random rand = new Random();
ObjectMapper mapper = new ObjectMapper();
for (int i = 0; i < 40; i++) {
Person person = getRandomPerson(rand);
try {
docs.add(new CosmosItemProperties(mapper.writeValueAsString(person)));
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
} | e.printStackTrace(); | public void generateTestData() {
Random rand = new Random();
ObjectMapper mapper = new ObjectMapper();
for (int i = 0; i < 40; i++) {
Person person = getRandomPerson(rand);
try {
docs.add(new CosmosItemProperties(mapper.writeValueAsString(person)));
} catch (JsonProcessingException e) {
logger.error(e.getMessage());
}
... | class DistinctQueryTests extends TestSuiteBase {
private final String FIELD = "name";
private CosmosAsyncContainer createdCollection;
private ArrayList<CosmosItemProperties> docs = new ArrayList<>();
private CosmosAsyncClient client;
@Factory(dataProvider = "clientBuilders")
public DistinctQueryTests(CosmosClientBuilde... | class DistinctQueryTests extends TestSuiteBase {
private final int TIMEOUT_120 = 120000;
private final String FIELD = "name";
private CosmosAsyncContainer createdCollection;
private ArrayList<CosmosItemProperties> docs = new ArrayList<>();
private CosmosAsyncClient client;
@Factory(dataProvider = "clientBuildersWithDir... |
Yeah it should be, corrected the test | public void objectOrder(DistinctQueryType queryType) {
String resource1 = String.format("{ "
+ "\"id\": \"12345\", "
+ "\"mypk\": \"abcde\""
+ "} ");
String resource2 = String.format("{ "
+ "\"mypk\": \"abcde\","
+ "\"id\": \"12345\""
+ "} ");
DistinctMap distinctMap = DistinctMap.create(queryType, null);
Utils.ValueHo... | assertThat(add2).as("Order of objects in map should be treated same").isTrue(); | public void objectOrder(DistinctQueryType queryType) {
String resource1 = String.format("{ "
+ "\"id\": \"12345\","
+ "\"mypk\": \"abcde\""
+ "} ");
String resource2 = String.format("{ "
+ "\"mypk\": \"abcde\","
+ "\"id\": \"12345\""
+ "} ");
Document resource = new Document(resource1);
DistinctMap distinctMap = Distin... | class DistinctMapTest {
@DataProvider(name = "distinctMapArgProvider")
public Object[][] distinctMapArgProvider() {
return new Object[][] {
{DistinctQueryType.Ordered},
{DistinctQueryType.Unordered},
};
}
@Test(groups = "unit", dataProvider = "distinctMapArgProvider")
public void integerValue(DistinctQueryType queryTyp... | class DistinctMapTest {
@DataProvider(name = "distinctMapArgProvider")
public Object[][] distinctMapArgProvider() {
return new Object[][] {
{DistinctQueryType.ORDERED},
{DistinctQueryType.UNORDERED},
};
}
@Test(groups = "unit", dataProvider = "distinctMapArgProvider")
public void integerValue(DistinctQueryType queryTyp... |
Do you have a test that peeks the next sequence number? | void peekOneMessage() {
final int numberOfEvents = 1;
when(managementNode.peek())
.thenReturn(Mono.just(mock(ServiceBusReceivedMessage.class)));
StepVerifier.create(consumer.peek())
.expectNextCount(numberOfEvents)
.verifyComplete();
} | StepVerifier.create(consumer.peek()) | void peekOneMessage() {
final int numberOfEvents = 1;
when(managementNode.peek())
.thenReturn(just(mock(ServiceBusReceivedMessage.class)));
StepVerifier.create(consumer.peek())
.expectNextCount(numberOfEvents)
.verifyComplete();
} | class ServiceBusReceiverAsyncClientTest {
private static final String PAYLOAD = "hello";
private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8);
private static final int PREFETCH = 5;
private static final String NAMESPACE = "my-namespace-foo";
private static final String ENTITY_NAME = "queue-name";
private... | class ServiceBusReceiverAsyncClientTest {
private static final String PAYLOAD = "hello";
private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8);
private static final int PREFETCH = 5;
private static final String NAMESPACE = "my-namespace-foo";
private static final String ENTITY_NAME = "queue-name";
private... |
Can you leave a comment about how this behavior is safer and resolves the issue in question so we have some context in case we ever have to investigate it later? | Mono<BlobBatchOperationInfo> prepareBlobBatchSubmission() {
if (batchOperationQueue.isEmpty()) {
return monoError(logger, new UnsupportedOperationException("Empty batch requests aren't allowed."));
}
BlobBatchOperationInfo operationInfo = new BlobBatchOperationInfo();
Deque<BlobBatchOperation<?>> operations = batchOper... | List<Mono<? extends Response<?>>> batchOperationResponses = new ArrayList<>(); | Mono<BlobBatchOperationInfo> prepareBlobBatchSubmission() {
if (batchOperationQueue.isEmpty()) {
return monoError(logger, new UnsupportedOperationException("Empty batch requests aren't allowed."));
}
BlobBatchOperationInfo operationInfo = new BlobBatchOperationInfo();
Deque<BlobBatchOperation<?>> operations = batchOper... | class BlobBatch {
private static final String X_MS_VERSION = "x-ms-version";
private static final String BATCH_REQUEST_URL_PATH = "Batch-Request-Url-Path";
private static final String BATCH_OPERATION_RESPONSE = "Batch-Operation-Response";
private static final String BATCH_OPERATION_INFO = "Batch-Operation-Info";
privat... | class BlobBatch {
private static final String X_MS_VERSION = "x-ms-version";
private static final String BATCH_REQUEST_URL_PATH = "Batch-Request-Url-Path";
private static final String BATCH_OPERATION_RESPONSE = "Batch-Operation-Response";
private static final String BATCH_OPERATION_INFO = "Batch-Operation-Info";
privat... |
Added a comment explaining the change and why it is safer and resolves the issue. | Mono<BlobBatchOperationInfo> prepareBlobBatchSubmission() {
if (batchOperationQueue.isEmpty()) {
return monoError(logger, new UnsupportedOperationException("Empty batch requests aren't allowed."));
}
BlobBatchOperationInfo operationInfo = new BlobBatchOperationInfo();
Deque<BlobBatchOperation<?>> operations = batchOper... | List<Mono<? extends Response<?>>> batchOperationResponses = new ArrayList<>(); | Mono<BlobBatchOperationInfo> prepareBlobBatchSubmission() {
if (batchOperationQueue.isEmpty()) {
return monoError(logger, new UnsupportedOperationException("Empty batch requests aren't allowed."));
}
BlobBatchOperationInfo operationInfo = new BlobBatchOperationInfo();
Deque<BlobBatchOperation<?>> operations = batchOper... | class BlobBatch {
private static final String X_MS_VERSION = "x-ms-version";
private static final String BATCH_REQUEST_URL_PATH = "Batch-Request-Url-Path";
private static final String BATCH_OPERATION_RESPONSE = "Batch-Operation-Response";
private static final String BATCH_OPERATION_INFO = "Batch-Operation-Info";
privat... | class BlobBatch {
private static final String X_MS_VERSION = "x-ms-version";
private static final String BATCH_REQUEST_URL_PATH = "Batch-Request-Url-Path";
private static final String BATCH_OPERATION_RESPONSE = "Batch-Operation-Response";
private static final String BATCH_OPERATION_INFO = "Batch-Operation-Info";
privat... |
This isn't actually necessary, especially since we specify overwrite on downloadToFile. | public static void main(String[] args) throws IOException, NoSuchAlgorithmException {
/*
* 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 crea... | File largeFile = createTempEmptyFile(filename); | public static void main(String[] args) throws IOException, NoSuchAlgorithmException {
/*
* 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 crea... | class FileTransferExample {
private static final String LARGE_TEST_FOLDER = "test-large-files/";
/**
* Entry point into the file transfer examples for Storage datalake.
* @param args Unused. Arguments to the program.
* @throws IOException If an I/O error occurs
* @throws NoSuchAlgorithmException If {@code MD5} isn't su... | class FileTransferExample {
private static final String LARGE_TEST_FOLDER = "test-large-files/";
/**
* Entry point into the file transfer examples for Storage datalake.
* @param args Unused. Arguments to the program.
* @throws IOException If an I/O error occurs
* @throws NoSuchAlgorithmException If {@code MD5} isn't su... |
I think its fine in the sample just cause that helper will go through and make sure the upload/download file is in the same directory. | public static void main(String[] args) throws IOException, NoSuchAlgorithmException {
/*
* 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 crea... | File largeFile = createTempEmptyFile(filename); | public static void main(String[] args) throws IOException, NoSuchAlgorithmException {
/*
* 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 crea... | class FileTransferExample {
private static final String LARGE_TEST_FOLDER = "test-large-files/";
/**
* Entry point into the file transfer examples for Storage datalake.
* @param args Unused. Arguments to the program.
* @throws IOException If an I/O error occurs
* @throws NoSuchAlgorithmException If {@code MD5} isn't su... | class FileTransferExample {
private static final String LARGE_TEST_FOLDER = "test-large-files/";
/**
* Entry point into the file transfer examples for Storage datalake.
* @param args Unused. Arguments to the program.
* @throws IOException If an I/O error occurs
* @throws NoSuchAlgorithmException If {@code MD5} isn't su... |
nit: new line | private List<ServiceBusReceivedMessage> deserializeListOfMessages(Message amqpMessage) {
List<Message> listAmqpMessages = convertAMQPValueMessageToBrokeredMessage(amqpMessage);
List<ServiceBusReceivedMessage> receivedMessageList = new ArrayList<>();
for (Message oneAmqpMessage:listAmqpMessages
) {
ServiceBusReceivedMes... | ) { | private List<ServiceBusReceivedMessage> deserializeListOfMessages(Message amqpMessage) {
List<Message> listAmqpMessages = convertAmqpValueMessageToBrokeredMessage(amqpMessage);
List<ServiceBusReceivedMessage> receivedMessageList = new ArrayList<>();
for (Message oneAmqpMessage:listAmqpMessages) {
ServiceBusReceivedMess... | class ServiceBusMessageSerializer implements MessageSerializer {
private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
private static final String ENQUEUED_TIME_UTC_NAME = "x-opt-enqueued-time";
private static final String SCHEDULED_ENQUEUE_TIME_NAME = "x-opt-scheduled-enqueue-time";
private static final String S... | class ServiceBusMessageSerializer implements MessageSerializer {
private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
private static final String ENQUEUED_TIME_UTC_NAME = "x-opt-enqueued-time";
private static final String SCHEDULED_ENQUEUE_TIME_NAME = "x-opt-scheduled-enqueue-time";
private static final String S... |
It is already there in `@AfterEach` | void peekWithSequenceOneMessage() {
final int numberOfEvents = 1;
final int fromSequenceNumber = 10;
when(managementNode.peek(fromSequenceNumber))
.thenReturn(Mono.just(mock(ServiceBusReceivedMessage.class)));
StepVerifier.create(consumer.peek(fromSequenceNumber))
.expectNextCount(numberOfEvents)
.verifyComplete();
Moc... | Mockito.framework().clearInlineMocks(); | void peekWithSequenceOneMessage() {
final int numberOfEvents = 1;
final int fromSequenceNumber = 10;
when(managementNode.peek(fromSequenceNumber))
.thenReturn(just(mock(ServiceBusReceivedMessage.class)));
StepVerifier.create(consumer.peek(fromSequenceNumber))
.expectNextCount(numberOfEvents)
.verifyComplete();
} | class ServiceBusReceiverAsyncClientTest {
private static final String PAYLOAD = "hello";
private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8);
private static final int PREFETCH = 5;
private static final String NAMESPACE = "my-namespace-foo";
private static final String ENTITY_NAME = "queue-name";
private... | class ServiceBusReceiverAsyncClientTest {
private static final String PAYLOAD = "hello";
private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8);
private static final int PREFETCH = 5;
private static final String NAMESPACE = "my-namespace-foo";
private static final String ENTITY_NAME = "queue-name";
private... |
Every time a peek operation is called, it'll create another management channel node. This is a bit wasteful if we keep getting the management node and have to recreate it. | public Mono<ServiceBusManagementNode> getManagementNode(String entityPath) {
if (isDisposed()) {
return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format(
"connectionId[%s]: Connection is disposed. Cannot get management instance for '%s'",
connectionId, entityPath))));
}
final ServiceBusMana... | TokenManager cbsBasedTokenManager = new AzureTokenManagerProvider( | public Mono<ServiceBusManagementNode> getManagementNode(String entityPath) {
if (isDisposed()) {
return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format(
"connectionId[%s]: Connection is disposed. Cannot get management instance for '%s'",
connectionId, entityPath))));
}
final ServiceBusMana... | class ServiceBusReactorAmqpConnection extends ReactorConnection implements ServiceBusAmqpConnection {
private static final String MANAGEMENT_SESSION_NAME = "mgmt-session";
private static final String MANAGEMENT_LINK_NAME = "mgmt";
private static final String MANAGEMENT_ADDRESS = "$management";
/** This is used in setti... | class ServiceBusReactorAmqpConnection extends ReactorConnection implements ServiceBusAmqpConnection {
private static final String MANAGEMENT_SESSION_NAME = "mgmt-session";
private static final String MANAGEMENT_LINK_NAME = "mgmt";
private static final String MANAGEMENT_ADDRESS = "$management";
private final ClientLogge... |
Move these to tests and use stepverifier. | public void peekOneMessage() {
final int numberOfEvents = 1;
String connectionString = System.getenv("AZURE_SERVICEBUS_CONNECTION_STRING")
+ ";EntityPath=hemant-test1";
log(connectionString);
ServiceBusReceiverAsyncClient queueReceiverAsyncClient = new ServiceBusClientBuilder()
.connectionString(connectionString)
.sche... | Thread.sleep(90000); | public void peekOneMessage() {
final int numberOfEvents = 1;
StepVerifier.create(consumer.peek())
.then(() -> sendMessages(numberOfEvents))
.expectNextCount(numberOfEvents)
.verifyComplete();
verify(amqpReceiveLink, times(1));
} | class ServiceBusReceiverAsyncClientPeek {
private static final String PAYLOAD = "hello";
private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8);
private static final int PREFETCH = 1;
private final ClientLogger logger = new ClientLogger(ServiceBusReceiverAsyncClientPeek.class);
private final String message... | class ServiceBusReceiverAsyncClientPeek {
private static final String PAYLOAD = "hello";
private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8);
private static final int PREFETCH = 1;
private final ClientLogger logger = new ClientLogger(ServiceBusReceiverAsyncClientPeek.class);
private final String message... |
sender.send(message).then(receiver.peek()) is probably what you want. thenMany suggests it returns a flux. | void peekMessage() {
final String messageId = UUID.randomUUID().toString();
final String contents = "Some-contents";
final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0);
final ReceiveMessageOptions options = new ReceiveMessageOptions().setAutoComplete(true);
receiver = createBuilder... | StepVerifier.create(sender.send(message).thenMany(receiver.peek())) | void peekMessage() {
final String messageId = UUID.randomUUID().toString();
final String contents = "Some-contents";
final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0);
StepVerifier.create(sender.send(message).then(receiver.peek()))
.assertNext(receivedMessage -> {
Assertions.asser... | class ServiceBusReceiverAsyncClientIntegrationTest extends IntegrationTestBase {
private ServiceBusReceiverAsyncClient receiver;
private ServiceBusSenderAsyncClient sender;
ServiceBusReceiverAsyncClientIntegrationTest() {
super(new ClientLogger(ServiceBusReceiverAsyncClientIntegrationTest.class));
}
@Override
protected... | class ServiceBusReceiverAsyncClientIntegrationTest extends IntegrationTestBase {
private ServiceBusReceiverAsyncClient receiver;
private ServiceBusSenderAsyncClient sender;
private ReceiveMessageOptions receiveMessageOptions;
ServiceBusReceiverAsyncClientIntegrationTest() {
super(new ClientLogger(ServiceBusReceiverAsyn... |
When you return inline mocks like this, you need to add the Mockito.clearInlinMocks() or else it won't be garbage collected. | void peekWithSequenceOneMessage() {
final int numberOfEvents = 1;
final int fromSequenceNumber = 10;
when(managementNode.peek(fromSequenceNumber))
.thenReturn(Mono.just(mock(ServiceBusReceivedMessage.class)));
StepVerifier.create(consumer.peek(fromSequenceNumber))
.expectNextCount(numberOfEvents)
.verifyComplete();
} | .thenReturn(Mono.just(mock(ServiceBusReceivedMessage.class))); | void peekWithSequenceOneMessage() {
final int numberOfEvents = 1;
final int fromSequenceNumber = 10;
when(managementNode.peek(fromSequenceNumber))
.thenReturn(just(mock(ServiceBusReceivedMessage.class)));
StepVerifier.create(consumer.peek(fromSequenceNumber))
.expectNextCount(numberOfEvents)
.verifyComplete();
} | class ServiceBusReceiverAsyncClientTest {
private static final String PAYLOAD = "hello";
private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8);
private static final int PREFETCH = 5;
private static final String NAMESPACE = "my-namespace-foo";
private static final String ENTITY_NAME = "queue-name";
private... | class ServiceBusReceiverAsyncClientTest {
private static final String PAYLOAD = "hello";
private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8);
private static final int PREFETCH = 5;
private static final String NAMESPACE = "my-namespace-foo";
private static final String ENTITY_NAME = "queue-name";
private... |
v2 should not use PagedList. This class is provided since return type in v2 is PagedIterable, which is not compatibly with v1 PagedList. | protected void loadNextPage() {
this.items.addAll(pagedResponseIterator.next().getValue());
} | this.items.addAll(pagedResponseIterator.next().getValue()); | protected void loadNextPage() {
this.items.addAll(pagedResponseIterator.next().getValue());
} | class PagedList<E> implements List<E> {
/** The items retrieved. */
private final List<E> items;
/** The paged response iterator for not retrieved items. */
private Iterator<PagedResponse<E>> pagedResponseIterator;
/**
* Creates an instance of PagedList.
*/
public PagedList() {
items = new ArrayList<>();
pagedResponseI... | class PagedList<E> implements List<E> {
/** The items retrieved. */
private final List<E> items;
/** The paged response iterator for not retrieved items. */
private Iterator<PagedResponse<E>> pagedResponseIterator;
/**
* Creates an instance of PagedList.
*/
public PagedList() {
items = new ArrayList<>();
pagedResponseI... |
Good catch... | void peekMessage() {
final String messageId = UUID.randomUUID().toString();
final String contents = "Some-contents";
final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0);
final ReceiveMessageOptions options = new ReceiveMessageOptions().setAutoComplete(true);
receiver = createBuilder... | StepVerifier.create(sender.send(message).thenMany(receiver.peek())) | void peekMessage() {
final String messageId = UUID.randomUUID().toString();
final String contents = "Some-contents";
final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0);
StepVerifier.create(sender.send(message).then(receiver.peek()))
.assertNext(receivedMessage -> {
Assertions.asser... | class ServiceBusReceiverAsyncClientIntegrationTest extends IntegrationTestBase {
private ServiceBusReceiverAsyncClient receiver;
private ServiceBusSenderAsyncClient sender;
ServiceBusReceiverAsyncClientIntegrationTest() {
super(new ClientLogger(ServiceBusReceiverAsyncClientIntegrationTest.class));
}
@Override
protected... | class ServiceBusReceiverAsyncClientIntegrationTest extends IntegrationTestBase {
private ServiceBusReceiverAsyncClient receiver;
private ServiceBusSenderAsyncClient sender;
private ReceiveMessageOptions receiveMessageOptions;
ServiceBusReceiverAsyncClientIntegrationTest() {
super(new ClientLogger(ServiceBusReceiverAsyn... |
I have tested with 4 peek() calls from one client , since we are storing `ServiceBusManagementNode` in `ConcurrentHashMap` and return cached managementNode after once created using `managementNodes.computeIfAbsent` . So it creates `ServiceBusManagementNode` only once. https://github.com/Azure/azure-sdk-for-java/pull/... | public Mono<ServiceBusManagementNode> getManagementNode(String entityPath) {
if (isDisposed()) {
return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format(
"connectionId[%s]: Connection is disposed. Cannot get management instance for '%s'",
connectionId, entityPath))));
}
final ServiceBusMana... | TokenManager cbsBasedTokenManager = new AzureTokenManagerProvider( | public Mono<ServiceBusManagementNode> getManagementNode(String entityPath) {
if (isDisposed()) {
return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format(
"connectionId[%s]: Connection is disposed. Cannot get management instance for '%s'",
connectionId, entityPath))));
}
final ServiceBusMana... | class ServiceBusReactorAmqpConnection extends ReactorConnection implements ServiceBusAmqpConnection {
private static final String MANAGEMENT_SESSION_NAME = "mgmt-session";
private static final String MANAGEMENT_LINK_NAME = "mgmt";
private static final String MANAGEMENT_ADDRESS = "$management";
/** This is used in setti... | class ServiceBusReactorAmqpConnection extends ReactorConnection implements ServiceBusAmqpConnection {
private static final String MANAGEMENT_SESSION_NAME = "mgmt-session";
private static final String MANAGEMENT_LINK_NAME = "mgmt";
private static final String MANAGEMENT_ADDRESS = "$management";
private final ClientLogge... |
added this test | void peekOneMessage() {
final int numberOfEvents = 1;
when(managementNode.peek())
.thenReturn(Mono.just(mock(ServiceBusReceivedMessage.class)));
StepVerifier.create(consumer.peek())
.expectNextCount(numberOfEvents)
.verifyComplete();
} | StepVerifier.create(consumer.peek()) | void peekOneMessage() {
final int numberOfEvents = 1;
when(managementNode.peek())
.thenReturn(just(mock(ServiceBusReceivedMessage.class)));
StepVerifier.create(consumer.peek())
.expectNextCount(numberOfEvents)
.verifyComplete();
} | class ServiceBusReceiverAsyncClientTest {
private static final String PAYLOAD = "hello";
private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8);
private static final int PREFETCH = 5;
private static final String NAMESPACE = "my-namespace-foo";
private static final String ENTITY_NAME = "queue-name";
private... | class ServiceBusReceiverAsyncClientTest {
private static final String PAYLOAD = "hello";
private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8);
private static final int PREFETCH = 5;
private static final String NAMESPACE = "my-namespace-foo";
private static final String ENTITY_NAME = "queue-name";
private... |
You should dispose of the existing one (created in BeforeEach) if you are going to recreate it. It'll still consume resources. | void peekMessage() {
final String messageId = UUID.randomUUID().toString();
final String contents = "Some-contents";
final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0);
final ReceiveMessageOptions options = new ReceiveMessageOptions().setAutoComplete(true);
receiver = createBuilder... | receiver = createBuilder() | void peekMessage() {
final String messageId = UUID.randomUUID().toString();
final String contents = "Some-contents";
final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0);
StepVerifier.create(sender.send(message).then(receiver.peek()))
.assertNext(receivedMessage -> {
Assertions.asser... | class ServiceBusReceiverAsyncClientIntegrationTest extends IntegrationTestBase {
private ServiceBusReceiverAsyncClient receiver;
private ServiceBusSenderAsyncClient sender;
ServiceBusReceiverAsyncClientIntegrationTest() {
super(new ClientLogger(ServiceBusReceiverAsyncClientIntegrationTest.class));
}
@Override
protected... | class ServiceBusReceiverAsyncClientIntegrationTest extends IntegrationTestBase {
private ServiceBusReceiverAsyncClient receiver;
private ServiceBusSenderAsyncClient sender;
private ReceiveMessageOptions receiveMessageOptions;
ServiceBusReceiverAsyncClientIntegrationTest() {
super(new ClientLogger(ServiceBusReceiverAsyn... |
Should put this in AfterEach, if the test fails at line 163, it'll never be run. | void peekWithSequenceOneMessage() {
final int numberOfEvents = 1;
final int fromSequenceNumber = 10;
when(managementNode.peek(fromSequenceNumber))
.thenReturn(Mono.just(mock(ServiceBusReceivedMessage.class)));
StepVerifier.create(consumer.peek(fromSequenceNumber))
.expectNextCount(numberOfEvents)
.verifyComplete();
Moc... | Mockito.framework().clearInlineMocks(); | void peekWithSequenceOneMessage() {
final int numberOfEvents = 1;
final int fromSequenceNumber = 10;
when(managementNode.peek(fromSequenceNumber))
.thenReturn(just(mock(ServiceBusReceivedMessage.class)));
StepVerifier.create(consumer.peek(fromSequenceNumber))
.expectNextCount(numberOfEvents)
.verifyComplete();
} | class ServiceBusReceiverAsyncClientTest {
private static final String PAYLOAD = "hello";
private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8);
private static final int PREFETCH = 5;
private static final String NAMESPACE = "my-namespace-foo";
private static final String ENTITY_NAME = "queue-name";
private... | class ServiceBusReceiverAsyncClientTest {
private static final String PAYLOAD = "hello";
private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8);
private static final int PREFETCH = 5;
private static final String NAMESPACE = "my-namespace-foo";
private static final String ENTITY_NAME = "queue-name";
private... |
This can be the diamond operator on the right hand side | private EndpointCache getOrAddEndpoint(URI endpoint) {
EndpointCache endpointCache = this.addressCacheByEndpoint.computeIfAbsent(endpoint , key -> {
GatewayAddressCache gatewayAddressCache = new GatewayAddressCache(endpoint, protocol, this.tokenProvider, this.userAgentContainer, this.httpClient);
AddressResolver addres... | List<URI> allEndpoints = new ArrayList<URI>(this.endpointManager.getWriteEndpoints()); | private EndpointCache getOrAddEndpoint(URI endpoint) {
EndpointCache endpointCache = this.addressCacheByEndpoint.computeIfAbsent(endpoint , key -> {
GatewayAddressCache gatewayAddressCache = new GatewayAddressCache(endpoint, protocol, this.tokenProvider, this.userAgentContainer, this.httpClient);
AddressResolver addres... | class GlobalAddressResolver implements IAddressResolver {
private final static int MaxBackupReadRegions = 3;
private final GlobalEndpointManager endpointManager;
private final Protocol protocol;
private final IAuthorizationTokenProvider tokenProvider;
private final UserAgentContainer userAgentContainer;
private final R... | class GlobalAddressResolver implements IAddressResolver {
private final static int MaxBackupReadRegions = 3;
private final GlobalEndpointManager endpointManager;
private final Protocol protocol;
private final IAuthorizationTokenProvider tokenProvider;
private final UserAgentContainer userAgentContainer;
private final R... |
this can be simplified to `verify(asyncSender).createBatch();` | void createBatchDefault() {
ServiceBusMessageBatch batch = new ServiceBusMessageBatch(MAX_MESSAGE_LENGTH_BYTES, null, null,
null);
when(asyncSender.createBatch()).thenReturn(Mono.just(batch));
ServiceBusMessageBatch batchMessage = sender.createBatch();
Assertions.assertEquals(MAX_MESSAGE_LENGTH_BYTES, batchMessage.get... | verify(asyncSender, times(1)).createBatch(); | void createBatchDefault() {
ServiceBusMessageBatch batch = new ServiceBusMessageBatch(MAX_MESSAGE_LENGTH_BYTES, null, null,
null);
when(asyncSender.createBatch()).thenReturn(Mono.just(batch));
ServiceBusMessageBatch batchMessage = sender.createBatch();
Assertions.assertEquals(MAX_MESSAGE_LENGTH_BYTES, batchMessage.get... | class ServiceBusSenderClientTest {
private static final String NAMESPACE = "my-namespace";
private static final String ENTITY_NAME = "my-servicebus-entity";
@Mock
private ErrorContextProvider errorContextProvider;
@Mock
private ServiceBusSenderAsyncClient asyncSender;
@Captor
private ArgumentCaptor<ServiceBusMessage> s... | class ServiceBusSenderClientTest {
private static final String NAMESPACE = "my-namespace";
private static final String ENTITY_NAME = "my-servicebus-entity";
@Mock
private ServiceBusSenderAsyncClient asyncSender;
@Captor
private ArgumentCaptor<ServiceBusMessage> singleMessageCaptor;
private ServiceBusSenderClient sender... |
Don't introduce more guava dependencies! :-) Use the standard Java APIs for hashcode | public int hashCode() {
if (this.components == null || this.components.size() == 0) {
return 0;
}
int [] ordinals = new int[this.components.size()];
for (int i = 0; i < this.components.size(); i++) {
ordinals[i] = this.components.get(i).GetTypeOrdinal();
}
return Objects.hashCode(ordinals);
} | } | public int hashCode() {
return super.hashCode();
} | class PartitionKeyInternal implements Comparable<PartitionKeyInternal> {
private static final String TYPE = "type";
private static final String MIN_NUMBER = "MinNumber";
private static final String MAX_NUMBER = "MaxNumber";
private static final String MIN_STRING = "MinString";
private static final String MAX_STRING = "... | class PartitionKeyInternal implements Comparable<PartitionKeyInternal> {
private static final String TYPE = "type";
private static final String MIN_NUMBER = "MinNumber";
private static final String MAX_NUMBER = "MaxNumber";
private static final String MIN_STRING = "MinString";
private static final String MAX_STRING = "... |
I think this should have T and `Class<T>` instead of Object | public static CosmosAsyncItemResponse<Object> createCosmosAsyncItemResponseWithObjectType(ResourceResponse<Document> response) {
return new CosmosAsyncItemResponse<>(response, Object.class);
} | return new CosmosAsyncItemResponse<>(response, Object.class); | public static CosmosAsyncItemResponse<Object> createCosmosAsyncItemResponseWithObjectType(ResourceResponse<Document> response) {
return new CosmosAsyncItemResponse<>(response, Object.class);
} | class ModelBridgeInternal {
public static CosmosAsyncConflictResponse createCosmosAsyncConflictResponse(ResourceResponse<Conflict> response,
CosmosAsyncContainer container) {
return new CosmosAsyncConflictResponse(response, container);
}
public static CosmosAsyncContainerResponse createCosmosAsyncContainerResponse(Reso... | class ModelBridgeInternal {
public static CosmosAsyncConflictResponse createCosmosAsyncConflictResponse(ResourceResponse<Conflict> response,
CosmosAsyncContainer container) {
return new CosmosAsyncConflictResponse(response, container);
}
public static CosmosAsyncContainerResponse createCosmosAsyncContainerResponse(Reso... |
@moderakh - the method `createCosmosAsyncItemResponseWithObjectType` is called from only one place with second parameter as `Object.class`. [here](https://github.com/Azure/azure-sdk-for-java/blob/2c32ea66cefeec207d9c88d5bff79961fc6e5cef/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncContainer.java#L5... | public static CosmosAsyncItemResponse<Object> createCosmosAsyncItemResponseWithObjectType(ResourceResponse<Document> response) {
return new CosmosAsyncItemResponse<>(response, Object.class);
} | return new CosmosAsyncItemResponse<>(response, Object.class); | public static CosmosAsyncItemResponse<Object> createCosmosAsyncItemResponseWithObjectType(ResourceResponse<Document> response) {
return new CosmosAsyncItemResponse<>(response, Object.class);
} | class ModelBridgeInternal {
public static CosmosAsyncConflictResponse createCosmosAsyncConflictResponse(ResourceResponse<Conflict> response,
CosmosAsyncContainer container) {
return new CosmosAsyncConflictResponse(response, container);
}
public static CosmosAsyncContainerResponse createCosmosAsyncContainerResponse(Reso... | class ModelBridgeInternal {
public static CosmosAsyncConflictResponse createCosmosAsyncConflictResponse(ResourceResponse<Conflict> response,
CosmosAsyncContainer container) {
return new CosmosAsyncConflictResponse(response, container);
}
public static CosmosAsyncContainerResponse createCosmosAsyncContainerResponse(Reso... |
:) removed | public int hashCode() {
if (this.components == null || this.components.size() == 0) {
return 0;
}
int [] ordinals = new int[this.components.size()];
for (int i = 0; i < this.components.size(); i++) {
ordinals[i] = this.components.get(i).GetTypeOrdinal();
}
return Objects.hashCode(ordinals);
} | } | public int hashCode() {
return super.hashCode();
} | class PartitionKeyInternal implements Comparable<PartitionKeyInternal> {
private static final String TYPE = "type";
private static final String MIN_NUMBER = "MinNumber";
private static final String MAX_NUMBER = "MaxNumber";
private static final String MIN_STRING = "MinString";
private static final String MAX_STRING = "... | class PartitionKeyInternal implements Comparable<PartitionKeyInternal> {
private static final String TYPE = "type";
private static final String MIN_NUMBER = "MinNumber";
private static final String MAX_NUMBER = "MaxNumber";
private static final String MIN_STRING = "MinString";
private static final String MAX_STRING = "... |
@moderakh - yes this particular API is specifically for Object type -> as this is being called by deleteItem(String id) -> which doesn't take any class type information. So this is for generic object type. | public static CosmosAsyncItemResponse<Object> createCosmosAsyncItemResponseWithObjectType(ResourceResponse<Document> response) {
return new CosmosAsyncItemResponse<>(response, Object.class);
} | return new CosmosAsyncItemResponse<>(response, Object.class); | public static CosmosAsyncItemResponse<Object> createCosmosAsyncItemResponseWithObjectType(ResourceResponse<Document> response) {
return new CosmosAsyncItemResponse<>(response, Object.class);
} | class ModelBridgeInternal {
public static CosmosAsyncConflictResponse createCosmosAsyncConflictResponse(ResourceResponse<Conflict> response,
CosmosAsyncContainer container) {
return new CosmosAsyncConflictResponse(response, container);
}
public static CosmosAsyncContainerResponse createCosmosAsyncContainerResponse(Reso... | class ModelBridgeInternal {
public static CosmosAsyncConflictResponse createCosmosAsyncConflictResponse(ResourceResponse<Conflict> response,
CosmosAsyncContainer container) {
return new CosmosAsyncConflictResponse(response, container);
}
public static CosmosAsyncContainerResponse createCosmosAsyncContainerResponse(Reso... |
I am not sure about this one. @milismsft - can you please look at this `break` statement introduction change ? | public Mono<Void> run(CancellationToken cancellationToken) {
this.lastContinuation = this.settings.getStartContinuation();
this.isFirstQueryForChangeFeeds = true;
this.options.setRequestContinuation(this.lastContinuation);
return Flux.just(this)
.flatMap( value -> {
if (cancellationToken.isCancellationRequested()) {
re... | public Mono<Void> run(CancellationToken cancellationToken) {
this.lastContinuation = this.settings.getStartContinuation();
this.isFirstQueryForChangeFeeds = true;
this.options.setRequestContinuation(this.lastContinuation);
return Flux.just(this)
.flatMap( value -> {
if (cancellationToken.isCancellationRequested()) {
re... | class PartitionProcessorImpl implements PartitionProcessor {
private static final Logger logger = LoggerFactory.getLogger(PartitionProcessorImpl.class);
private static final int DefaultMaxItemCount = 100;
private final ProcessorSettings settings;
private final PartitionCheckpointer checkpointer;
private final ChangeFee... | class PartitionProcessorImpl implements PartitionProcessor {
private static final Logger logger = LoggerFactory.getLogger(PartitionProcessorImpl.class);
private static final int DefaultMaxItemCount = 100;
private final ProcessorSettings settings;
private final PartitionCheckpointer checkpointer;
private final ChangeFee... | |
Is it possible to suppress this warning and create a work item for this? | public int hashCode() {
if (this.components == null || this.components.size() == 0) {
return 0;
}
int [] ordinals = new int[this.components.size()];
for (int i = 0; i < this.components.size(); i++) {
ordinals[i] = this.components.get(i).GetTypeOrdinal();
}
return Objects.hashCode(ordinals);
} | } | public int hashCode() {
return super.hashCode();
} | class PartitionKeyInternal implements Comparable<PartitionKeyInternal> {
private static final String TYPE = "type";
private static final String MIN_NUMBER = "MinNumber";
private static final String MAX_NUMBER = "MaxNumber";
private static final String MIN_STRING = "MinString";
private static final String MAX_STRING = "... | class PartitionKeyInternal implements Comparable<PartitionKeyInternal> {
private static final String TYPE = "type";
private static final String MIN_NUMBER = "MinNumber";
private static final String MAX_NUMBER = "MaxNumber";
private static final String MIN_STRING = "MinString";
private static final String MAX_STRING = "... |
Is it possible to suppress this warning and create a work item for this? | public int hashCode() {
return Objects.hash(this.version, this.globalLsn, this.localLsnByRegion);
} | return Objects.hash(this.version, this.globalLsn, this.localLsnByRegion); | public int hashCode() {
return super.hashCode();
} | class VectorSessionToken implements ISessionToken {
private final static Logger logger = LoggerFactory.getLogger(VectorSessionToken.class);
private final static char SegmentSeparator = '
private final static char RegionProgressSeparator = '=';
private final long version;
private final long globalLsn;
private final Unmo... | class VectorSessionToken implements ISessionToken {
private final static Logger logger = LoggerFactory.getLogger(VectorSessionToken.class);
private final static char SegmentSeparator = '
private final static char RegionProgressSeparator = '=';
private final long version;
private final long globalLsn;
private final Unmo... |
Looks good. | public Mono<Void> run(CancellationToken cancellationToken) {
this.lastContinuation = this.settings.getStartContinuation();
this.isFirstQueryForChangeFeeds = true;
this.options.setRequestContinuation(this.lastContinuation);
return Flux.just(this)
.flatMap( value -> {
if (cancellationToken.isCancellationRequested()) {
re... | public Mono<Void> run(CancellationToken cancellationToken) {
this.lastContinuation = this.settings.getStartContinuation();
this.isFirstQueryForChangeFeeds = true;
this.options.setRequestContinuation(this.lastContinuation);
return Flux.just(this)
.flatMap( value -> {
if (cancellationToken.isCancellationRequested()) {
re... | class PartitionProcessorImpl implements PartitionProcessor {
private static final Logger logger = LoggerFactory.getLogger(PartitionProcessorImpl.class);
private static final int DefaultMaxItemCount = 100;
private final ProcessorSettings settings;
private final PartitionCheckpointer checkpointer;
private final ChangeFee... | class PartitionProcessorImpl implements PartitionProcessor {
private static final Logger logger = LoggerFactory.getLogger(PartitionProcessorImpl.class);
private static final int DefaultMaxItemCount = 100;
private final ProcessorSettings settings;
private final PartitionCheckpointer checkpointer;
private final ChangeFee... | |
Ok, now uses the default hashCode from the base class. | public int hashCode() {
if (this.components == null || this.components.size() == 0) {
return 0;
}
int [] ordinals = new int[this.components.size()];
for (int i = 0; i < this.components.size(); i++) {
ordinals[i] = this.components.get(i).GetTypeOrdinal();
}
return Objects.hashCode(ordinals);
} | } | public int hashCode() {
return super.hashCode();
} | class PartitionKeyInternal implements Comparable<PartitionKeyInternal> {
private static final String TYPE = "type";
private static final String MIN_NUMBER = "MinNumber";
private static final String MAX_NUMBER = "MaxNumber";
private static final String MIN_STRING = "MinString";
private static final String MAX_STRING = "... | class PartitionKeyInternal implements Comparable<PartitionKeyInternal> {
private static final String TYPE = "type";
private static final String MIN_NUMBER = "MinNumber";
private static final String MAX_NUMBER = "MaxNumber";
private static final String MIN_STRING = "MinString";
private static final String MAX_STRING = "... |
and I see there is an issue link to complete the implementation. | public int hashCode() {
if (this.components == null || this.components.size() == 0) {
return 0;
}
int [] ordinals = new int[this.components.size()];
for (int i = 0; i < this.components.size(); i++) {
ordinals[i] = this.components.get(i).GetTypeOrdinal();
}
return Objects.hashCode(ordinals);
} | } | public int hashCode() {
return super.hashCode();
} | class PartitionKeyInternal implements Comparable<PartitionKeyInternal> {
private static final String TYPE = "type";
private static final String MIN_NUMBER = "MinNumber";
private static final String MAX_NUMBER = "MaxNumber";
private static final String MIN_STRING = "MinString";
private static final String MAX_STRING = "... | class PartitionKeyInternal implements Comparable<PartitionKeyInternal> {
private static final String TYPE = "type";
private static final String MIN_NUMBER = "MinNumber";
private static final String MAX_NUMBER = "MaxNumber";
private static final String MIN_STRING = "MinString";
private static final String MAX_STRING = "... |
code indentation needs to be fixed. | public Mono<AccessToken> getToken(TokenRequestContext request) {
final StringBuilder errorMsg = new StringBuilder();
return Flux.fromIterable(credentials).flatMap(p -> p.getToken(request).onErrorResume(t -> {
if (t.getMessage() != null && !t.getMessage().contains("authentication unavailable")) {
throw new RuntimeExcept... | return Flux.fromIterable(credentials).flatMap(p -> p.getToken(request).onErrorResume(t -> { | public Mono<AccessToken> getToken(TokenRequestContext request) {
List<CredentialUnavailableException> exceptions = new ArrayList<>(4);
return Flux.fromIterable(credentials)
.flatMap(p -> p.getToken(request).onErrorResume(Exception.class, t -> {
if (!t.getClass().getSimpleName().equals("CredentialUnavailableException"))... | class ChainedTokenCredential implements TokenCredential {
private final Deque<TokenCredential> credentials;
private final String UnavailableError=this.getClass().getSimpleName()+" authentication failed. -> ";
private final String FailedError=this.getClass().getSimpleName()+" failed to retrieve a token from the included... | class ChainedTokenCredential implements TokenCredential {
private final Deque<TokenCredential> credentials;
private final String unavailableError = this.getClass().getSimpleName() + " authentication failed. ---> ";
/**
* Create an instance of chained token credential that aggregates a list of token
* credentials.
*/
Ch... |
This error message is not properly formatted, spacing issues will show up before 'authentication failed' text. | public Mono<AccessToken> getToken(TokenRequestContext request) {
final StringBuilder errorMsg = new StringBuilder();
return Flux.fromIterable(credentials).flatMap(p -> p.getToken(request).onErrorResume(t -> {
if (t.getMessage() != null && !t.getMessage().contains("authentication unavailable")) {
throw new RuntimeExcept... | throw new RuntimeException(UnavailableError+p.getClass().getSimpleName()+"authentication failed.",t); | public Mono<AccessToken> getToken(TokenRequestContext request) {
List<CredentialUnavailableException> exceptions = new ArrayList<>(4);
return Flux.fromIterable(credentials)
.flatMap(p -> p.getToken(request).onErrorResume(Exception.class, t -> {
if (!t.getClass().getSimpleName().equals("CredentialUnavailableException"))... | class ChainedTokenCredential implements TokenCredential {
private final Deque<TokenCredential> credentials;
private final String UnavailableError=this.getClass().getSimpleName()+" authentication failed. -> ";
private final String FailedError=this.getClass().getSimpleName()+" failed to retrieve a token from the included... | class ChainedTokenCredential implements TokenCredential {
private final Deque<TokenCredential> credentials;
private final String unavailableError = this.getClass().getSimpleName() + " authentication failed. ---> ";
/**
* Create an instance of chained token credential that aggregates a list of token
* credentials.
*/
Ch... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.