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
thanks for the debugging. The change from `Optional<String>` to `String` means that `getOdataNextLink()` now returns a string or null if there is no `odata.nextLink` in the response. I replaced `isPresent()` with a null check in https://github.com/Azure/azure-sdk-for-java/pull/14305/commits/cc20c0521dbed11c5ffc661c23d...
private List<UserGroup> loadUserGroups(String graphApiToken) throws IOException { String responseInJson = getUserMemberships(graphApiToken, Optional.empty()); final List<UserGroup> lUserGroups = new ArrayList<>(); final ObjectMapper objectMapper = JacksonObjectMapperFactory.getInstance(); objectMapper.registerModule(ne...
while (groupsFromJson.getOdataNextLink().isPresent()) {
private List<UserGroup> loadUserGroups(String graphApiToken) throws IOException { String responseInJson = getUserMemberships(graphApiToken, null); final List<UserGroup> lUserGroups = new ArrayList<>(); final ObjectMapper objectMapper = JacksonObjectMapperFactory.getInstance(); UserGroups groupsFromJson = objectMapper.r...
class AzureADGraphClient { private static final Logger LOGGER = LoggerFactory.getLogger(AzureADGraphClient.class); private static final SimpleGrantedAuthority DEFAULT_AUTHORITY = new SimpleGrantedAuthority("ROLE_USER"); private static final String DEFAULT_ROLE_PREFIX = "ROLE_"; private static final String MICROSOFT_GRA...
class AzureADGraphClient { private static final Logger LOGGER = LoggerFactory.getLogger(AzureADGraphClient.class); private static final SimpleGrantedAuthority DEFAULT_AUTHORITY = new SimpleGrantedAuthority("ROLE_USER"); private static final String DEFAULT_ROLE_PREFIX = "ROLE_"; private static final String MICROSOFT_GRA...
this fix is not related to empty id but it is a quick fix for make sure the async and sync tests are verifying the same thing. Previously they are verifying the error.
public void recognizeEntitiesBatchInputSingleError(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); recognizeBatchCategorizedEntitySingleErrorRunner((inputs) -> StepVerifier.create(client.recognizeEntitiesBatchWithResponse(inputs, nul...
assertEquals(String.format(BATCH_ERROR_EXCEPTION_MESSAGE, "RecognizeEntitiesResult"), exception.getMessage());
public void recognizeEntitiesBatchInputSingleError(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); recognizeBatchCategorizedEntitySingleErrorRunner((inputs) -> StepVerifier.create(client.recognizeEntitiesBatchWithResponse(inputs, nul...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } private TextAnalyticsAsyncClient getTe...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } private TextAnalyticsAsyncClient getTe...
same reason as https://github.com/Azure/azure-sdk-for-java/pull/14324/files#r474852892
public void recognizePiiEntitiesBatchInputSingleError(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); recognizeBatchPiiEntitySingleErrorRunner((inputs) -> StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, null)...
.assertNext(resultCollection -> resultCollection.getValue().forEach(recognizePiiEntitiesResult -> {
public void recognizePiiEntitiesBatchInputSingleError(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); recognizeBatchPiiEntitySingleErrorRunner((inputs) -> StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, null)...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } private TextAnalyticsAsyncClient getTe...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } private TextAnalyticsAsyncClient getTe...
Seems like form [here](https://github.com/Azure/azure-sdk-for-java/pull/14324/files#diff-f8937ef2df39148b27c109212931fa8aR18) we are getting non-null values. What exactly is missing?
public void detectLanguageEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); detectLanguageInputEmptyIdRunner(inputs -> StepVerifier.create(client.detectLanguageBatchWithResponse(inputs, null)) .verifyErrorSatisfies(ex -> {...
public void detectLanguageEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); detectLanguageInputEmptyIdRunner(inputs -> StepVerifier.create(client.detectLanguageBatchWithResponse(inputs, null)) .verifyErrorSatisfies(ex -> {...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } private TextAnalyticsAsyncClient getTe...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } private TextAnalyticsAsyncClient getTe...
The JSON output is same as the postman output. Java deserialization doesn't parse the "error" object in this case. More detail can be found in here: https://teams.microsoft.com/l/message/19:d6ff4003f5c848a2a2d6dcdfc0ebd497@thread.skype/1597103339389?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=3e17dcb0-4257-4a...
public void detectLanguageEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); detectLanguageInputEmptyIdRunner(inputs -> StepVerifier.create(client.detectLanguageBatchWithResponse(inputs, null)) .verifyErrorSatisfies(ex -> {...
public void detectLanguageEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); detectLanguageInputEmptyIdRunner(inputs -> StepVerifier.create(client.detectLanguageBatchWithResponse(inputs, null)) .verifyErrorSatisfies(ex -> {...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } private TextAnalyticsAsyncClient getTe...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } private TextAnalyticsAsyncClient getTe...
just to clarify, you're going to start asserting the error code and message once you regenerate with the swagger fix?
public void recognizeEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); tooManyDocumentsRunner(inputs -> StepVerifier.create(client.recognizeEntitiesBatch(inputs, null, null)) .verifyErrorSatisfies(ex -> { ...
public void recognizeEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); tooManyDocumentsRunner(inputs -> StepVerifier.create(client.recognizeEntitiesBatch(inputs, null, null)) .verifyErrorSatisfies(ex -> { ...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } private TextAnalyticsAsyncClient getTe...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } private TextAnalyticsAsyncClient getTe...
I will only assert the error code. Johan's comments in Cognitive Scrum chat: ""Note: we should not (in the general case) be asserting on error messages. I would not consider localizing error messages to be a breaking change, for example..."" and "Yes. I assume that we don't have client library dependencies on the me...
public void recognizeEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); tooManyDocumentsRunner(inputs -> StepVerifier.create(client.recognizeEntitiesBatch(inputs, null, null)) .verifyErrorSatisfies(ex -> { ...
public void recognizeEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { client = getTextAnalyticsAsyncClient(httpClient, serviceVersion); tooManyDocumentsRunner(inputs -> StepVerifier.create(client.recognizeEntitiesBatch(inputs, null, null)) .verifyErrorSatisfies(ex -> { ...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } private TextAnalyticsAsyncClient getTe...
class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsAsyncClient client; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } private TextAnalyticsAsyncClient getTe...
```suggestion return cosmosItem; ``` on this if branch the item is InternalObjectNode you don't need to serialze and deserialize again.
public static InternalObjectNode fromObjectToInternalObjectNode(Object cosmosItem) { if (cosmosItem instanceof InternalObjectNode) { return new InternalObjectNode(((InternalObjectNode) cosmosItem).toJson()); } else if (cosmosItem instanceof byte[]) { return new InternalObjectNode((byte[]) cosmosItem); } else { try { re...
return new InternalObjectNode(((InternalObjectNode) cosmosItem).toJson());
public static InternalObjectNode fromObjectToInternalObjectNode(Object cosmosItem) { if (cosmosItem instanceof InternalObjectNode) { return (InternalObjectNode) cosmosItem; } else if (cosmosItem instanceof byte[]) { return new InternalObjectNode((byte[]) cosmosItem); } else { try { return new InternalObjectNode(Interna...
class InternalObjectNode extends Resource { private static final ObjectMapper MAPPER = Utils.getSimpleObjectMapper(); /** * Initialize an empty InternalObjectNode object. */ public InternalObjectNode() { } /** * Initialize a InternalObjectNode object from json string. * * @param bytes the json string that represents th...
class InternalObjectNode extends Resource { private static final ObjectMapper MAPPER = Utils.getSimpleObjectMapper(); /** * Initialize an empty InternalObjectNode object. */ public InternalObjectNode() { } /** * Initialize a InternalObjectNode object from json string. * * @param bytes the json string that represents th...
Good catch, fixed.
public static InternalObjectNode fromObjectToInternalObjectNode(Object cosmosItem) { if (cosmosItem instanceof InternalObjectNode) { return new InternalObjectNode(((InternalObjectNode) cosmosItem).toJson()); } else if (cosmosItem instanceof byte[]) { return new InternalObjectNode((byte[]) cosmosItem); } else { try { re...
return new InternalObjectNode(((InternalObjectNode) cosmosItem).toJson());
public static InternalObjectNode fromObjectToInternalObjectNode(Object cosmosItem) { if (cosmosItem instanceof InternalObjectNode) { return (InternalObjectNode) cosmosItem; } else if (cosmosItem instanceof byte[]) { return new InternalObjectNode((byte[]) cosmosItem); } else { try { return new InternalObjectNode(Interna...
class InternalObjectNode extends Resource { private static final ObjectMapper MAPPER = Utils.getSimpleObjectMapper(); /** * Initialize an empty InternalObjectNode object. */ public InternalObjectNode() { } /** * Initialize a InternalObjectNode object from json string. * * @param bytes the json string that represents th...
class InternalObjectNode extends Resource { private static final ObjectMapper MAPPER = Utils.getSimpleObjectMapper(); /** * Initialize an empty InternalObjectNode object. */ public InternalObjectNode() { } /** * Initialize a InternalObjectNode object from json string. * * @param bytes the json string that represents th...
To keep same code style, please use `information.getPartitionKeyPath()` directly instead of define `partitionKeyPath`.
public CosmosContainerProperties createContainerIfNotExists(CosmosEntityInformation<?, ?> information) { final String partitionKeyPath = information.getPartitionKeyPath(); final CosmosContainerResponse response = cosmosAsyncClient .createDatabaseIfNotExists(this.databaseName) .publishOn(Schedulers.parallel()) .onErrorR...
new CosmosContainerProperties(information.getContainerName(), partitionKeyPath);
public CosmosContainerProperties createContainerIfNotExists(CosmosEntityInformation<?, ?> information) { final CosmosContainerResponse response = cosmosAsyncClient .createDatabaseIfNotExists(this.databaseName) .publishOn(Schedulers.parallel()) .onErrorResume(throwable -> CosmosExceptionUtils.exceptionHandler("Failed to...
class type of domain * @return found results in a List */ public <T> Iterable<T> findAll(String containerName, final Class<T> domainType) { Assert.hasText(containerName, "containerName should not be null, empty or only whitespaces"); Assert.notNull(domainType, "domainType should not be null"); final CosmosQuery query =...
class type of domain * @return found results in a List */ public <T> Iterable<T> findAll(String containerName, final Class<T> domainType) { Assert.hasText(containerName, "containerName should not be null, empty or only whitespaces"); Assert.notNull(domainType, "domainType should not be null"); final CosmosQuery query =...
To keep same code style, please use `information.getPartitionKeyPath()` directly instead of define `partitionKeyPath`.
public Mono<CosmosContainerResponse> createContainerIfNotExists(CosmosEntityInformation<?, ?> information) { final String partitionKeyPath = information.getPartitionKeyPath(); return cosmosAsyncClient .createDatabaseIfNotExists(this.databaseName) .publishOn(Schedulers.parallel()) .onErrorResume(throwable -> CosmosExcep...
new CosmosContainerProperties(information.getContainerName(), partitionKeyPath);
public Mono<CosmosContainerResponse> createContainerIfNotExists(CosmosEntityInformation<?, ?> information) { return cosmosAsyncClient .createDatabaseIfNotExists(this.databaseName) .publishOn(Schedulers.parallel()) .onErrorResume(throwable -> CosmosExceptionUtils.exceptionHandler("Failed to create database", throwable))...
class ReactiveCosmosTemplate implements ReactiveCosmosOperations, ApplicationContextAware { private final MappingCosmosConverter mappingCosmosConverter; private final String databaseName; private final ResponseDiagnosticsProcessor responseDiagnosticsProcessor; private final boolean queryMetricsEnabled; private final Co...
class ReactiveCosmosTemplate implements ReactiveCosmosOperations, ApplicationContextAware { private final MappingCosmosConverter mappingCosmosConverter; private final String databaseName; private final ResponseDiagnosticsProcessor responseDiagnosticsProcessor; private final boolean queryMetricsEnabled; private final Co...
Makes sense, updated.
public CosmosContainerProperties createContainerIfNotExists(CosmosEntityInformation<?, ?> information) { final String partitionKeyPath = information.getPartitionKeyPath(); final CosmosContainerResponse response = cosmosAsyncClient .createDatabaseIfNotExists(this.databaseName) .publishOn(Schedulers.parallel()) .onErrorR...
new CosmosContainerProperties(information.getContainerName(), partitionKeyPath);
public CosmosContainerProperties createContainerIfNotExists(CosmosEntityInformation<?, ?> information) { final CosmosContainerResponse response = cosmosAsyncClient .createDatabaseIfNotExists(this.databaseName) .publishOn(Schedulers.parallel()) .onErrorResume(throwable -> CosmosExceptionUtils.exceptionHandler("Failed to...
class type of domain * @return found results in a List */ public <T> Iterable<T> findAll(String containerName, final Class<T> domainType) { Assert.hasText(containerName, "containerName should not be null, empty or only whitespaces"); Assert.notNull(domainType, "domainType should not be null"); final CosmosQuery query =...
class type of domain * @return found results in a List */ public <T> Iterable<T> findAll(String containerName, final Class<T> domainType) { Assert.hasText(containerName, "containerName should not be null, empty or only whitespaces"); Assert.notNull(domainType, "domainType should not be null"); final CosmosQuery query =...
Makes sense, updated.
public Mono<CosmosContainerResponse> createContainerIfNotExists(CosmosEntityInformation<?, ?> information) { final String partitionKeyPath = information.getPartitionKeyPath(); return cosmosAsyncClient .createDatabaseIfNotExists(this.databaseName) .publishOn(Schedulers.parallel()) .onErrorResume(throwable -> CosmosExcep...
new CosmosContainerProperties(information.getContainerName(), partitionKeyPath);
public Mono<CosmosContainerResponse> createContainerIfNotExists(CosmosEntityInformation<?, ?> information) { return cosmosAsyncClient .createDatabaseIfNotExists(this.databaseName) .publishOn(Schedulers.parallel()) .onErrorResume(throwable -> CosmosExceptionUtils.exceptionHandler("Failed to create database", throwable))...
class ReactiveCosmosTemplate implements ReactiveCosmosOperations, ApplicationContextAware { private final MappingCosmosConverter mappingCosmosConverter; private final String databaseName; private final ResponseDiagnosticsProcessor responseDiagnosticsProcessor; private final boolean queryMetricsEnabled; private final Co...
class ReactiveCosmosTemplate implements ReactiveCosmosOperations, ApplicationContextAware { private final MappingCosmosConverter mappingCosmosConverter; private final String databaseName; private final ResponseDiagnosticsProcessor responseDiagnosticsProcessor; private final boolean queryMetricsEnabled; private final Co...
how about setting on variable declaration itself
public CosmosQueryRequestOptions() { this.queryMetricsEnabled = true; }
this.queryMetricsEnabled = true;
public CosmosQueryRequestOptions() { this.queryMetricsEnabled = true; }
class CosmosQueryRequestOptions { private String sessionToken; private String partitionKeyRangeId; private Boolean scanInQueryEnabled; private Boolean emitVerboseTracesInQuery; private int maxDegreeOfParallelism; private int maxBufferedItemCount; private int responseContinuationTokenLimitInKb; private Integer maxItemCo...
class CosmosQueryRequestOptions { private String sessionToken; private String partitionKeyRangeId; private Boolean scanInQueryEnabled; private Boolean emitVerboseTracesInQuery; private int maxDegreeOfParallelism; private int maxBufferedItemCount; private int responseContinuationTokenLimitInKb; private Integer maxItemCo...
Looks like the most common pattern has been to initialize in the ctor if a ctor is present - CosmosDatabaseProperties, CosmosTriggerProperties etc. - so followed that approach for consistency.
public CosmosQueryRequestOptions() { this.queryMetricsEnabled = true; }
this.queryMetricsEnabled = true;
public CosmosQueryRequestOptions() { this.queryMetricsEnabled = true; }
class CosmosQueryRequestOptions { private String sessionToken; private String partitionKeyRangeId; private Boolean scanInQueryEnabled; private Boolean emitVerboseTracesInQuery; private int maxDegreeOfParallelism; private int maxBufferedItemCount; private int responseContinuationTokenLimitInKb; private Integer maxItemCo...
class CosmosQueryRequestOptions { private String sessionToken; private String partitionKeyRangeId; private Boolean scanInQueryEnabled; private Boolean emitVerboseTracesInQuery; private int maxDegreeOfParallelism; private int maxBufferedItemCount; private int responseContinuationTokenLimitInKb; private Integer maxItemCo...
Looks like we didn't update the java doc at first place that the default value is `false`. @FabianMeiswinkel - now would be a good time to update the java docs to mention that default value is `true`
public CosmosQueryRequestOptions() { this.queryMetricsEnabled = true; }
this.queryMetricsEnabled = true;
public CosmosQueryRequestOptions() { this.queryMetricsEnabled = true; }
class CosmosQueryRequestOptions { private String sessionToken; private String partitionKeyRangeId; private Boolean scanInQueryEnabled; private Boolean emitVerboseTracesInQuery; private int maxDegreeOfParallelism; private int maxBufferedItemCount; private int responseContinuationTokenLimitInKb; private Integer maxItemCo...
class CosmosQueryRequestOptions { private String sessionToken; private String partitionKeyRangeId; private Boolean scanInQueryEnabled; private Boolean emitVerboseTracesInQuery; private int maxDegreeOfParallelism; private int maxBufferedItemCount; private int responseContinuationTokenLimitInKb; private Integer maxItemCo...
Fixed in next iteration.
public CosmosQueryRequestOptions() { this.queryMetricsEnabled = true; }
this.queryMetricsEnabled = true;
public CosmosQueryRequestOptions() { this.queryMetricsEnabled = true; }
class CosmosQueryRequestOptions { private String sessionToken; private String partitionKeyRangeId; private Boolean scanInQueryEnabled; private Boolean emitVerboseTracesInQuery; private int maxDegreeOfParallelism; private int maxBufferedItemCount; private int responseContinuationTokenLimitInKb; private Integer maxItemCo...
class CosmosQueryRequestOptions { private String sessionToken; private String partitionKeyRangeId; private Boolean scanInQueryEnabled; private Boolean emitVerboseTracesInQuery; private int maxDegreeOfParallelism; private int maxBufferedItemCount; private int responseContinuationTokenLimitInKb; private Integer maxItemCo...
justCurious why delay is added ?
protected Mono<Void> populateIndex(int documentCount, String documentSize) { /* * Generate the count of documents using the given size. Then, upload the documents in batches of 100, this * prevents the batch from triggering the services request size limit to fail. Finally, continuously poll the * index for its document...
.delaySubscription(Duration.ofSeconds(1))
protected Mono<Void> populateIndex(int documentCount, String documentSize) { /* * Generate the count of documents using the given size. Then, upload the documents in batches of 100, this * prevents the batch from triggering the services request size limit to fail. Finally, continuously poll the * index for its document...
class ServiceTest<TOptions extends PerfStressOptions> extends PerfStressTest<TOptions> { private static final String CONFIGURATION_ERROR = "Configuration %s must be set in either environment variables " + "or system properties.%n"; private static final String ALLOWED_INDEX_CHARACTERS = "abcdefghijklmnopqrstuvwxyz012345...
class ServiceTest<TOptions extends PerfStressOptions> extends PerfStressTest<TOptions> { private static final String CONFIGURATION_ERROR = "Configuration %s must be set in either environment variables " + "or system properties.%n"; private static final String ALLOWED_INDEX_CHARACTERS = "abcdefghijklmnopqrstuvwxyz012345...
The indexName generation logic can be optionally replaced with this. ```java this.indexName = random.ints(0, ALLOWED_INDEX_CHARACTERS.length()) .limit(INDEX_NAME_LENGTH) .collect(StringBuilder::new, ((stringBuilder, value) -> stringBuilder.append(ALLOWED_INDEX_CHARACTERS.charAt(value))), Str...
public ServiceTest(TOptions options) { super(options); String searchEndpoint = Configuration.getGlobalConfiguration().get("SEARCH_ENDPOINT"); if (CoreUtils.isNullOrEmpty(searchEndpoint)) { System.out.printf(CONFIGURATION_ERROR, "SEARCH_ENDPOINT"); System.exit(1); } String searchApiKey = Configuration.getGlobalConfigura...
this.indexName = stringBuilder.toString();
public ServiceTest(TOptions options) { super(options); String searchEndpoint = Configuration.getGlobalConfiguration().get("SEARCH_ENDPOINT"); if (CoreUtils.isNullOrEmpty(searchEndpoint)) { System.out.printf(CONFIGURATION_ERROR, "SEARCH_ENDPOINT"); System.exit(1); } String searchApiKey = Configuration.getGlobalConfigura...
class ServiceTest<TOptions extends PerfStressOptions> extends PerfStressTest<TOptions> { private static final String CONFIGURATION_ERROR = "Configuration %s must be set in either environment variables " + "or system properties.%n"; private static final String ALLOWED_INDEX_CHARACTERS = "abcdefghijklmnopqrstuvwxyz012345...
class ServiceTest<TOptions extends PerfStressOptions> extends PerfStressTest<TOptions> { private static final String CONFIGURATION_ERROR = "Configuration %s must be set in either environment variables " + "or system properties.%n"; private static final String ALLOWED_INDEX_CHARACTERS = "abcdefghijklmnopqrstuvwxyz012345...
Document indexing doesn't always complete instantly, so I don't want to begin testing while it is still running nor do I want to spam the service with a ton of requests.
protected Mono<Void> populateIndex(int documentCount, String documentSize) { /* * Generate the count of documents using the given size. Then, upload the documents in batches of 100, this * prevents the batch from triggering the services request size limit to fail. Finally, continuously poll the * index for its document...
.delaySubscription(Duration.ofSeconds(1))
protected Mono<Void> populateIndex(int documentCount, String documentSize) { /* * Generate the count of documents using the given size. Then, upload the documents in batches of 100, this * prevents the batch from triggering the services request size limit to fail. Finally, continuously poll the * index for its document...
class ServiceTest<TOptions extends PerfStressOptions> extends PerfStressTest<TOptions> { private static final String CONFIGURATION_ERROR = "Configuration %s must be set in either environment variables " + "or system properties.%n"; private static final String ALLOWED_INDEX_CHARACTERS = "abcdefghijklmnopqrstuvwxyz012345...
class ServiceTest<TOptions extends PerfStressOptions> extends PerfStressTest<TOptions> { private static final String CONFIGURATION_ERROR = "Configuration %s must be set in either environment variables " + "or system properties.%n"; private static final String ALLOWED_INDEX_CHARACTERS = "abcdefghijklmnopqrstuvwxyz012345...
Will do a slight variant on this, using `random.ints(long streamSize, int lowerBound, int upperBound)`.
public ServiceTest(TOptions options) { super(options); String searchEndpoint = Configuration.getGlobalConfiguration().get("SEARCH_ENDPOINT"); if (CoreUtils.isNullOrEmpty(searchEndpoint)) { System.out.printf(CONFIGURATION_ERROR, "SEARCH_ENDPOINT"); System.exit(1); } String searchApiKey = Configuration.getGlobalConfigura...
this.indexName = stringBuilder.toString();
public ServiceTest(TOptions options) { super(options); String searchEndpoint = Configuration.getGlobalConfiguration().get("SEARCH_ENDPOINT"); if (CoreUtils.isNullOrEmpty(searchEndpoint)) { System.out.printf(CONFIGURATION_ERROR, "SEARCH_ENDPOINT"); System.exit(1); } String searchApiKey = Configuration.getGlobalConfigura...
class ServiceTest<TOptions extends PerfStressOptions> extends PerfStressTest<TOptions> { private static final String CONFIGURATION_ERROR = "Configuration %s must be set in either environment variables " + "or system properties.%n"; private static final String ALLOWED_INDEX_CHARACTERS = "abcdefghijklmnopqrstuvwxyz012345...
class ServiceTest<TOptions extends PerfStressOptions> extends PerfStressTest<TOptions> { private static final String CONFIGURATION_ERROR = "Configuration %s must be set in either environment variables " + "or system properties.%n"; private static final String ALLOWED_INDEX_CHARACTERS = "abcdefghijklmnopqrstuvwxyz012345...
just checking, Does the Rest API contract always guarantee a response when response code is 200 ? Here and other spots below too.
public Mono<Void> runAsync() { return searchAsyncClient.autocomplete("historic", SUGGESTER_NAME) .count() .flatMap(count -> count > 0 ? Mono.empty() : Mono.error(new RuntimeException("Expected autocomplete results."))); }
.count()
public Mono<Void> runAsync() { return searchAsyncClient.autocomplete("historic", SUGGESTER_NAME) .count() .flatMap(count -> count > 0 ? Mono.empty() : Mono.error(new RuntimeException("Expected autocomplete results."))); }
class AutocompleteTest extends ServiceTest<SearchPerfStressOptions> { public AutocompleteTest(SearchPerfStressOptions options) { super(options); } @Override public Mono<Void> globalSetupAsync() { /* * First, run the global setup in the super class. That will create the index to be used for performance * testing. Then p...
class AutocompleteTest extends ServiceTest<SearchPerfStressOptions> { public AutocompleteTest(SearchPerfStressOptions options) { super(options); } @Override public Mono<Void> globalSetupAsync() { /* * First, run the global setup in the super class. That will create the index to be used for performance * testing. Then p...
There is never a complete guarantee on the request being successful, for performance tests how should be handle the case were an operation fails? Do we prevent that iteration from being counted in the metrics?
public Mono<Void> runAsync() { return searchAsyncClient.autocomplete("historic", SUGGESTER_NAME) .count() .flatMap(count -> count > 0 ? Mono.empty() : Mono.error(new RuntimeException("Expected autocomplete results."))); }
.count()
public Mono<Void> runAsync() { return searchAsyncClient.autocomplete("historic", SUGGESTER_NAME) .count() .flatMap(count -> count > 0 ? Mono.empty() : Mono.error(new RuntimeException("Expected autocomplete results."))); }
class AutocompleteTest extends ServiceTest<SearchPerfStressOptions> { public AutocompleteTest(SearchPerfStressOptions options) { super(options); } @Override public Mono<Void> globalSetupAsync() { /* * First, run the global setup in the super class. That will create the index to be used for performance * testing. Then p...
class AutocompleteTest extends ServiceTest<SearchPerfStressOptions> { public AutocompleteTest(SearchPerfStressOptions options) { super(options); } @Override public Mono<Void> globalSetupAsync() { /* * First, run the global setup in the super class. That will create the index to be used for performance * testing. Then p...
Forgive my lack of Flux, but in the case where there's a failure state (all retries exhausted), you remove the batch sequence number, each of the event sequence numbers, and don't update state right?
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
.then(Mono.fromRunnable(() -> {
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final Symbol PRODUCER_EPOCH = Symbol.valueOf( AmqpMessageConstant.PRODUCER_EPOCH_ANNOTATION_NAME.getValue()); priva...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
can we flatten this into an &&
public Mono<EventDataBatch> createBatch(CreateBatchOptions options) { if (options == null) { return monoError(logger, new NullPointerException("'options' cannot be null.")); } if (this.isIdempotentPartitionPublishing) { if (CoreUtils.isNullOrEmpty(options.getPartitionId())) { return monoError(logger, new IllegalArgumen...
if (CoreUtils.isNullOrEmpty(options.getPartitionId())) {
public Mono<EventDataBatch> createBatch(CreateBatchOptions options) { if (options == null) { return monoError(logger, new NullPointerException("'options' cannot be null.")); } if (isIdempotentPartitionPublishing && CoreUtils.isNullOrEmpty(options.getPartitionId())) { return monoError(logger, new IllegalArgumentExceptio...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
Good question. `then` won't be reached if the send has an error.
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
.then(Mono.fromRunnable(() -> {
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final Symbol PRODUCER_EPOCH = Symbol.valueOf( AmqpMessageConstant.PRODUCER_EPOCH_ANNOTATION_NAME.getValue()); priva...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
Consistent use of `this`.
Mono<Void> send(Flux<EventData> events, SendOptions options) { if (events == null) { return monoError(logger, new NullPointerException("'events' cannot be null.")); } else if (options == null) { return monoError(logger, new NullPointerException("'options' cannot be null.")); } else if (options.getPartitionId() == null ...
} else if (options.getPartitionId() == null && this.isIdempotentPartitionPublishing) {
Mono<Void> send(Flux<EventData> events, SendOptions options) { if (events == null) { return monoError(logger, new NullPointerException("'events' cannot be null.")); } else if (options == null) { return monoError(logger, new NullPointerException("'options' cannot be null.")); } else if (options.getPartitionId() == null ...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
Does this part need to be in a mono? it seems ysnchronous to me.
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
publishingState.getSemaphore().acquireUninterruptibly();
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
Since we're synchronising on the entire class... is it possible to just synchronise on the parts that need to be?
private PartitionPublishingState getClientPartitionPublishingState(String partitionId) { if (!this.isIdempotentPartitionPublishing) { throw logger.logExceptionAsWarning( new IllegalStateException("getPartitionPublishingState() shouldn't be called if the producer" + " is not an idempotent producer.")); } if (this.partit...
synchronized (this) {
private PartitionPublishingState getClientPartitionPublishingState(String partitionId) { if (!isIdempotentPartitionPublishing) { throw logger.logExceptionAsWarning( new IllegalStateException("getPartitionPublishingState() shouldn't be called if the producer" + " is not an idempotent producer.")); } if (partitionPublish...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
We don't need `this.` It's implied because there is no other variable with the same name in this scope.
private Mono<AmqpSendLink> updatePublishingState(String partitionId, AmqpSendLink amqpSendLink) { if (this.isIdempotentPartitionPublishing) { return amqpSendLink.getRemoteProperties().map(properties -> { this.setPartitionPublishingState( partitionId, (Long) properties.get(SymbolConstants.PRODUCER_ID), (Short) propertie...
if (this.isIdempotentPartitionPublishing) {
private Mono<AmqpSendLink> updatePublishingState(String partitionId, AmqpSendLink amqpSendLink) { if (isIdempotentPartitionPublishing) { return amqpSendLink.getRemoteProperties().map(properties -> { setPartitionPublishingState( partitionId, (Long) properties.get(ClientConstants.PRODUCER_ID), (Short) properties.get(Clie...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
Same with other usages of `this`
private Mono<AmqpSendLink> updatePublishingState(String partitionId, AmqpSendLink amqpSendLink) { if (this.isIdempotentPartitionPublishing) { return amqpSendLink.getRemoteProperties().map(properties -> { this.setPartitionPublishingState( partitionId, (Long) properties.get(SymbolConstants.PRODUCER_ID), (Short) propertie...
if (this.isIdempotentPartitionPublishing) {
private Mono<AmqpSendLink> updatePublishingState(String partitionId, AmqpSendLink amqpSendLink) { if (isIdempotentPartitionPublishing) { return amqpSendLink.getRemoteProperties().map(properties -> { setPartitionPublishingState( partitionId, (Long) properties.get(ClientConstants.PRODUCER_ID), (Short) properties.get(Clie...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
@srnagar I'm torn on using a semaphore for this. thoughts?
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
publishingState.getSemaphore().acquireUninterruptibly();
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
The requirement is for a combination of a producer group and a partition, the send should be sequential. No concurrency is allowed because the service will check the producer sequence number assigned by the client. I spent long time in searching for a replacement of Semaphore for this use case. Any suggestions?
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
publishingState.getSemaphore().acquireUninterruptibly();
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
Done
public Mono<EventDataBatch> createBatch(CreateBatchOptions options) { if (options == null) { return monoError(logger, new NullPointerException("'options' cannot be null.")); } if (this.isIdempotentPartitionPublishing) { if (CoreUtils.isNullOrEmpty(options.getPartitionId())) { return monoError(logger, new IllegalArgumen...
if (CoreUtils.isNullOrEmpty(options.getPartitionId())) {
public Mono<EventDataBatch> createBatch(CreateBatchOptions options) { if (options == null) { return monoError(logger, new NullPointerException("'options' cannot be null.")); } if (isIdempotentPartitionPublishing && CoreUtils.isNullOrEmpty(options.getPartitionId())) { return monoError(logger, new IllegalArgumentExceptio...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
I actually prefer using `this` because it renders the information that the variable is a instance variable instead of a local. Anyway to sync with other code, I removed the this.
Mono<Void> send(Flux<EventData> events, SendOptions options) { if (events == null) { return monoError(logger, new NullPointerException("'events' cannot be null.")); } else if (options == null) { return monoError(logger, new NullPointerException("'options' cannot be null.")); } else if (options.getPartitionId() == null ...
} else if (options.getPartitionId() == null && this.isIdempotentPartitionPublishing) {
Mono<Void> send(Flux<EventData> events, SendOptions options) { if (events == null) { return monoError(logger, new NullPointerException("'events' cannot be null.")); } else if (options == null) { return monoError(logger, new NullPointerException("'options' cannot be null.")); } else if (options.getPartitionId() == null ...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
Yes, without a Mono, it's too eager to have the Semaphore and may cause some problems.
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
publishingState.getSemaphore().acquireUninterruptibly();
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
Ehm, the constructor adds `this` to the map.
public static Region create(String name, String label) { Objects.requireNonNull(name, "'name' cannot be null."); Region region = VALUES_BY_NAME.get(name.toLowerCase(Locale.ROOT)); if (region != null) { return region; } else { return new Region(name, label); } }
return new Region(name, label);
public static Region create(String name, String label) { Objects.requireNonNull(name, "'name' cannot be null."); Region region = VALUES_BY_NAME.get(name.toLowerCase(Locale.ROOT)); if (region != null) { return region; } else { return new Region(name, label); } }
class Region { private static final ConcurrentMap<String, Region> VALUES_BY_NAME = new ConcurrentHashMap<>(); /* * Azure Cloud - Americas */ /** * East US (US) (recommended) */ public static final Region US_EAST = new Region("eastus", "East US"); /** * East US 2 (US) (recommended) */ public static final Region US_EAST2...
class Region { private static final ConcurrentMap<String, Region> VALUES_BY_NAME = new ConcurrentHashMap<>(); /* * Azure Cloud - Americas */ /** * East US (US) (recommended) */ public static final Region US_EAST = new Region("eastus", "East US"); /** * East US 2 (US) (recommended) */ public static final Region US_EAST2...
Changed to synchronize on `partitionPublishingStates`.
private PartitionPublishingState getClientPartitionPublishingState(String partitionId) { if (!this.isIdempotentPartitionPublishing) { throw logger.logExceptionAsWarning( new IllegalStateException("getPartitionPublishingState() shouldn't be called if the producer" + " is not an idempotent producer.")); } if (this.partit...
synchronized (this) {
private PartitionPublishingState getClientPartitionPublishingState(String partitionId) { if (!isIdempotentPartitionPublishing) { throw logger.logExceptionAsWarning( new IllegalStateException("getPartitionPublishingState() shouldn't be called if the producer" + " is not an idempotent producer.")); } if (partitionPublish...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
Removed.
private Mono<AmqpSendLink> updatePublishingState(String partitionId, AmqpSendLink amqpSendLink) { if (this.isIdempotentPartitionPublishing) { return amqpSendLink.getRemoteProperties().map(properties -> { this.setPartitionPublishingState( partitionId, (Long) properties.get(SymbolConstants.PRODUCER_ID), (Short) propertie...
if (this.isIdempotentPartitionPublishing) {
private Mono<AmqpSendLink> updatePublishingState(String partitionId, AmqpSendLink amqpSendLink) { if (isIdempotentPartitionPublishing) { return amqpSendLink.getRemoteProperties().map(properties -> { setPartitionPublishingState( partitionId, (Long) properties.get(ClientConstants.PRODUCER_ID), (Short) properties.get(Clie...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
You're doing this assignment in each iteration of the for loop?
public EventHubClientBuilder initialPartitionPublishingStates(Map<String, PartitionPublishingProperties> states) { if (states != null) { this.initialPartitionPublishingStates = new HashMap<>(); states.forEach((partitionId, state) -> { this.initialPartitionPublishingStates.put(partitionId, new PartitionPublishingState(s...
this.initialPartitionPublishingStates =
public EventHubClientBuilder initialPartitionPublishingStates(Map<String, PartitionPublishingProperties> states) { if (states != null) { this.initialPartitionPublishingStates = new HashMap<>(); states.forEach((partitionId, state) -> { this.initialPartitionPublishingStates.put(partitionId, new PartitionPublishingState(s...
class EventHubClientBuilder { static final int DEFAULT_PREFETCH_COUNT = 500; static final int DEFAULT_PREFETCH_COUNT_FOR_SYNC_CLIENT = 1; /** * The name of the default consumer group in the Event Hubs service. */ public static final String DEFAULT_CONSUMER_GROUP_NAME = "$Default"; /** * The minimum value allowed for th...
class EventHubClientBuilder { static final int DEFAULT_PREFETCH_COUNT = 500; static final int DEFAULT_PREFETCH_COUNT_FOR_SYNC_CLIENT = 1; /** * The name of the default consumer group in the Event Hubs service. */ public static final String DEFAULT_CONSUMER_GROUP_NAME = "$Default"; /** * The minimum value allowed for th...
Do we need `inSysProperties` in these? It's an implementation detail. I just want to set the producer group, sequence number, etc on an Event Data, it doesn't matter to me where it is stored.
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
eventData.setProducerGroupIdInSysProperties(publishingState.getProducerGroupId());
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
I give it this specific name because `setProducerGroupIdInSysProperties` is internal and it doesn't set the value of property `producerGroupId`. After `setProducerGroupIdInSysProperties` is called, `getProducerGroupId` still returns null. After the event data is successfully sent out, the `commitProducerDataFromSysProp...
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
eventData.setProducerGroupIdInSysProperties(publishingState.getProducerGroupId());
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
Oops! What a negligence. Updated.
public EventHubClientBuilder initialPartitionPublishingStates(Map<String, PartitionPublishingProperties> states) { if (states != null) { this.initialPartitionPublishingStates = new HashMap<>(); states.forEach((partitionId, state) -> { this.initialPartitionPublishingStates.put(partitionId, new PartitionPublishingState(s...
this.initialPartitionPublishingStates =
public EventHubClientBuilder initialPartitionPublishingStates(Map<String, PartitionPublishingProperties> states) { if (states != null) { this.initialPartitionPublishingStates = new HashMap<>(); states.forEach((partitionId, state) -> { this.initialPartitionPublishingStates.put(partitionId, new PartitionPublishingState(s...
class EventHubClientBuilder { static final int DEFAULT_PREFETCH_COUNT = 500; static final int DEFAULT_PREFETCH_COUNT_FOR_SYNC_CLIENT = 1; /** * The name of the default consumer group in the Event Hubs service. */ public static final String DEFAULT_CONSUMER_GROUP_NAME = "$Default"; /** * The minimum value allowed for th...
class EventHubClientBuilder { static final int DEFAULT_PREFETCH_COUNT = 500; static final int DEFAULT_PREFETCH_COUNT_FOR_SYNC_CLIENT = 1; /** * The name of the default consumer group in the Event Hubs service. */ public static final String DEFAULT_CONSUMER_GROUP_NAME = "$Default"; /** * The minimum value allowed for th...
The other option was to consider Reentrant lock but since the thread that acquires the lock may not be the same as the one that releases it, semaphore is the only option here.
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
publishingState.getSemaphore().acquireUninterruptibly();
public Mono<Void> send(EventDataBatch batch) { if (batch == null) { return monoError(logger, new NullPointerException("'batch' cannot be null.")); } else if (batch.getEvents().isEmpty()) { logger.warning(Messages.CANNOT_SEND_EVENT_BATCH_EMPTY); return Mono.empty(); } if (!CoreUtils.isNullOrEmpty(batch.getPartitionId())...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
Looking at the [docs ](https://docs.microsoft.com/en-us/java/api/com.azure.storage.blob.specialized.blobasyncclientbase.download?view=azure-java-stable#com_azure_storage_blob_specialized_BlobAsyncClientBase_download__) for this API, would it be better to use this which is simpler, more closely matches the doc sample, a...
public Mono<Void> runAsync() { return blobAsyncClient.download() .map(b -> { int readCount = 0; int remaining = b.remaining(); while (readCount < remaining) { int expectedReadCount = Math.min(remaining - readCount, BUFFER_SIZE); b.get(buffer, 0, expectedReadCount); readCount += expectedReadCount; } return 1; }).then();...
int readCount = 0;
public Mono<Void> runAsync() { return blobAsyncClient.download() .map(b -> { int readCount = 0; int remaining = b.remaining(); while (readCount < remaining) { int expectedReadCount = Math.min(remaining - readCount, BUFFER_SIZE); b.get(buffer, 0, expectedReadCount); readCount += expectedReadCount; } return 1; }).then();...
class NullOutputStream extends OutputStream { @Override public void write(int b) { } @Override public void write(byte[] b) { } @Override public void write(byte[] b, int off, int len) { } }
class NullOutputStream extends OutputStream { @Override public void write(int b) { } @Override public void write(byte[] b) { } @Override public void write(byte[] b, int off, int len) { } }
Hmm, that sample should be updated as a `ByteBuffer` isn't guaranteed to have a backing `byte[]`. If the `ByteBuffer` instance is a `DirectByteBuffer` (aka OS managed memory) that will throw an exception.
public Mono<Void> runAsync() { return blobAsyncClient.download() .map(b -> { int readCount = 0; int remaining = b.remaining(); while (readCount < remaining) { int expectedReadCount = Math.min(remaining - readCount, BUFFER_SIZE); b.get(buffer, 0, expectedReadCount); readCount += expectedReadCount; } return 1; }).then();...
int readCount = 0;
public Mono<Void> runAsync() { return blobAsyncClient.download() .map(b -> { int readCount = 0; int remaining = b.remaining(); while (readCount < remaining) { int expectedReadCount = Math.min(remaining - readCount, BUFFER_SIZE); b.get(buffer, 0, expectedReadCount); readCount += expectedReadCount; } return 1; }).then();...
class NullOutputStream extends OutputStream { @Override public void write(int b) { } @Override public void write(byte[] b) { } @Override public void write(byte[] b, int off, int len) { } }
class NullOutputStream extends OutputStream { @Override public void write(int b) { } @Override public void write(byte[] b) { } @Override public void write(byte[] b, int off, int len) { } }
Unfortunately, we'll have to iterate through the collection twice - once to convert Iterable to list and then when serializing. This impacts performance. Not sure, if we can avoid this without changing the API to take a `List` instead.
Mono<Void> sendCustomEvents(Iterable<Object> events, Context context) { return Flux.fromIterable(events) .collectList() .flatMap(list -> this.impl.publishCustomEventEventsAsync(this.hostname, list, context)); }
.flatMap(list -> this.impl.publishCustomEventEventsAsync(this.hostname, list, context));
Mono<Void> sendCustomEvents(Iterable<Object> events, Context context) { return Flux.fromIterable(events) .collectList() .flatMap(list -> this.impl.publishCustomEventEventsAsync(this.hostname, list, context)); }
class EventGridPublisherAsyncClient { private final String hostname; private final EventGridPublisherClientImpl impl; private final EventGridServiceVersion serviceVersion; EventGridPublisherAsyncClient(HttpPipeline pipeline, String hostname, SerializerAdapter serializerAdapter, EventGridServiceVersion serviceVersion) {...
class EventGridPublisherAsyncClient { private final String hostname; private final EventGridPublisherClientImpl impl; private final EventGridServiceVersion serviceVersion; EventGridPublisherAsyncClient(HttpPipeline pipeline, String hostname, SerializerAdapter serializerAdapter, EventGridServiceVersion serviceVersion) {...
https://azure.github.io/azure-sdk/java_implementation.html#java-errors-system-errors Split the exception into NPE and IllegalArgumentException when the input is null and empty respectively.
public EventGridSasCredential(String sas) { if (CoreUtils.isNullOrEmpty(sas)) { throw logger.logExceptionAsError(new IllegalArgumentException("the access signature cannot be null or empty")); } this.sas = sas; }
}
public EventGridSasCredential(String sas) { if (sas == null) { throw logger.logExceptionAsError(new IllegalArgumentException("the access signature cannot be null")); } if (sas.isEmpty()) { throw logger.logExceptionAsError(new IllegalArgumentException("the access signature cannot be empty")); } this.sas = sas; }
class EventGridSasCredential { private String sas; private static final ClientLogger logger = new ClientLogger(EventGridSasCredential.class); /** * Generate a shared access signature to provide time-limited authentication for requests to the Event Grid * service. * @param endpoint the endpoint of the Event Grid t...
class EventGridSasCredential { private String sas; private static final ClientLogger logger = new ClientLogger(EventGridSasCredential.class); /** * Generate a shared access signature to provide time-limited authentication for requests to the Event Grid * service. * @param endpoint the endpoint of the Event Grid t...
Use string constants.
public Mono<MsalToken> authenticateWithBrowserInteraction(TokenRequestContext request, int port) { URI redirectUri; try { redirectUri = new URI(String.format("http: } catch (URISyntaxException e) { return Mono.error(logger.logExceptionAsError(new RuntimeException(e))); } InteractiveRequestParameters parameters = Intera...
redirectUri = new URI(String.format("http:
public Mono<MsalToken> authenticateWithBrowserInteraction(TokenRequestContext request, int port) { URI redirectUri; try { redirectUri = new URI(HTTP_LOCALHOST + ":" + port); } catch (URISyntaxException e) { return Mono.error(logger.logExceptionAsError(new RuntimeException(e))); } InteractiveRequestParameters parameters...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
Do you need to use `fromFuture`? Can it just be: ```java .flatMap(pc -> pc.acquireToken(parameters)); ```
public Mono<MsalToken> authenticateWithBrowserInteraction(TokenRequestContext request, int port) { URI redirectUri; try { redirectUri = new URI(String.format("http: } catch (URISyntaxException e) { return Mono.error(logger.logExceptionAsError(new RuntimeException(e))); } InteractiveRequestParameters parameters = Intera...
.flatMap(pc -> Mono.fromFuture(() -> pc.acquireToken(parameters)));
public Mono<MsalToken> authenticateWithBrowserInteraction(TokenRequestContext request, int port) { URI redirectUri; try { redirectUri = new URI(HTTP_LOCALHOST + ":" + port); } catch (URISyntaxException e) { return Mono.error(logger.logExceptionAsError(new RuntimeException(e))); } InteractiveRequestParameters parameters...
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 ...
its needed, because we get back a CompletableFuture.
public Mono<MsalToken> authenticateWithBrowserInteraction(TokenRequestContext request, int port) { URI redirectUri; try { redirectUri = new URI(String.format("http: } catch (URISyntaxException e) { return Mono.error(logger.logExceptionAsError(new RuntimeException(e))); } InteractiveRequestParameters parameters = Intera...
.flatMap(pc -> Mono.fromFuture(() -> pc.acquireToken(parameters)));
public Mono<MsalToken> authenticateWithBrowserInteraction(TokenRequestContext request, int port) { URI redirectUri; try { redirectUri = new URI(HTTP_LOCALHOST + ":" + port); } catch (URISyntaxException e) { return Mono.error(logger.logExceptionAsError(new RuntimeException(e))); } InteractiveRequestParameters parameters...
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 ...
same as above
public EventHubImpl withNewNamespace(Creatable<EventHubNamespace> namespaceCreatable) { this.addDependency(namespaceCreatable); if (namespaceCreatable instanceof EventHubNamespaceImpl) { EventHubNamespaceImpl namespace = ((EventHubNamespaceImpl) namespaceCreatable); this.ancestor = new Ancestors().new OneAncestor(names...
this.ancestor = new Ancestors().new OneAncestor(namespace.resourceGroupName(), namespaceCreatable.name());
public EventHubImpl withNewNamespace(Creatable<EventHubNamespace> namespaceCreatable) { this.addDependency(namespaceCreatable); if (namespaceCreatable instanceof EventHubNamespaceImpl) { EventHubNamespaceImpl namespace = ((EventHubNamespaceImpl) namespaceCreatable); this.ancestor = new Ancestors().new OneAncestor(names...
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private final ClientLogger logger = new ClientLogger(Ev...
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private Flux<Indexable> postRunTasks; private final Cli...
Please try test case which do both (NewSend and NewListen) in one Create/Update. I remember service not able to handle concurrent requests under eventhub, so these had to be done in sequence. https://github.com/Azure/azure-libraries-for-net/issues/891
public EventHubImpl withNewListenRule(final String ruleName) { addPostRunDependent(context -> manager().eventHubAuthorizationRules() .define(ruleName) .withExistingEventHub(ancestor().resourceGroupName(), ancestor().ancestor1Name(), name()) .withListenAccess() .createAsync() .last()); return this; }
}
public EventHubImpl withNewListenRule(final String ruleName) { concatPostRunTask(manager().eventHubAuthorizationRules() .define(ruleName) .withExistingEventHub(ancestor().resourceGroupName(), ancestor().ancestor1Name(), name()) .withListenAccess() .createAsync() .last()); return this; }
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private final ClientLogger logger = new ClientLogger(Ev...
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private Flux<Indexable> postRunTasks; private final Cli...
Do they have `without` method?
public EventHubImpl withNewListenRule(final String ruleName) { addPostRunDependent(context -> manager().eventHubAuthorizationRules() .define(ruleName) .withExistingEventHub(ancestor().resourceGroupName(), ancestor().ancestor1Name(), name()) .withListenAccess() .createAsync() .last()); return this; }
}
public EventHubImpl withNewListenRule(final String ruleName) { concatPostRunTask(manager().eventHubAuthorizationRules() .define(ruleName) .withExistingEventHub(ancestor().resourceGroupName(), ancestor().ancestor1Name(), name()) .withListenAccess() .createAsync() .last()); return this; }
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private final ClientLogger logger = new ClientLogger(Ev...
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private Flux<Indexable> postRunTasks; private final Cli...
I will add new method `withNewSendAndListenRule(ruleName)`. There is `withoutAuthorizationRule(ruleName)` to remove the authorization rule no matter what access it has.
public EventHubImpl withNewListenRule(final String ruleName) { addPostRunDependent(context -> manager().eventHubAuthorizationRules() .define(ruleName) .withExistingEventHub(ancestor().resourceGroupName(), ancestor().ancestor1Name(), name()) .withListenAccess() .createAsync() .last()); return this; }
}
public EventHubImpl withNewListenRule(final String ruleName) { concatPostRunTask(manager().eventHubAuthorizationRules() .define(ruleName) .withExistingEventHub(ancestor().resourceGroupName(), ancestor().ancestor1Name(), name()) .withListenAccess() .createAsync() .last()); return this; }
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private final ClientLogger logger = new ClientLogger(Ev...
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private Flux<Indexable> postRunTasks; private final Cli...
Eh, I didn't get it. What I mean is these REST requests under "eventhub" might need to be called sequentially, it might not be limited to this 2.
public EventHubImpl withNewListenRule(final String ruleName) { addPostRunDependent(context -> manager().eventHubAuthorizationRules() .define(ruleName) .withExistingEventHub(ancestor().resourceGroupName(), ancestor().ancestor1Name(), name()) .withListenAccess() .createAsync() .last()); return this; }
}
public EventHubImpl withNewListenRule(final String ruleName) { concatPostRunTask(manager().eventHubAuthorizationRules() .define(ruleName) .withExistingEventHub(ancestor().resourceGroupName(), ancestor().ancestor1Name(), name()) .withListenAccess() .createAsync() .last()); return this; }
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private final ClientLogger logger = new ClientLogger(Ev...
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private Flux<Indexable> postRunTasks; private final Cli...
After discuss offline, we decide to concat the post run tasks in eventhubs.
public EventHubImpl withNewListenRule(final String ruleName) { addPostRunDependent(context -> manager().eventHubAuthorizationRules() .define(ruleName) .withExistingEventHub(ancestor().resourceGroupName(), ancestor().ancestor1Name(), name()) .withListenAccess() .createAsync() .last()); return this; }
}
public EventHubImpl withNewListenRule(final String ruleName) { concatPostRunTask(manager().eventHubAuthorizationRules() .define(ruleName) .withExistingEventHub(ancestor().resourceGroupName(), ancestor().ancestor1Name(), name()) .withListenAccess() .createAsync() .last()); return this; }
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private final ClientLogger logger = new ClientLogger(Ev...
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private Flux<Indexable> postRunTasks; private final Cli...
```java postRunTasks = null; return Mono.empty(); ```
public Mono<Void> afterPostRunAsync(boolean isGroupFaulted) { return Mono.just(true) .map(aBoolean -> { postRunTasks = null; return aBoolean; }).then(); }
}
public Mono<Void> afterPostRunAsync(boolean isGroupFaulted) { postRunTasks = null; return Mono.empty(); }
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private Flux<Indexable> postRunTasks; private final Cli...
class EventHubImpl extends NestedResourceImpl<EventHub, EventhubInner, EventHubImpl> implements EventHub, EventHub.Definition, EventHub.Update { private Ancestors.OneAncestor ancestor; private CaptureSettings captureSettings; private StorageManager storageManager; private Flux<Indexable> postRunTasks; private final Cli...
same above
public Mono<Void> afterPostRunAsync(boolean isGroupFaulted) { return Mono.just(true) .map(aBoolean -> { postRunTasks = null; return aBoolean; }).then(); }
}).then();
public Mono<Void> afterPostRunAsync(boolean isGroupFaulted) { postRunTasks = null; return Mono.empty(); }
class EventHubNamespaceImpl extends GroupableResourceImpl<EventHubNamespace, EHNamespaceInner, EventHubNamespaceImpl, EventHubsManager> implements EventHubNamespace, EventHubNamespace.Definition, EventHubNamespace.Update { private Flux<Indexable> postRunTasks; protected EventHubNamespaceImpl(String name, EHNamespaceInn...
class EventHubNamespaceImpl extends GroupableResourceImpl<EventHubNamespace, EHNamespaceInner, EventHubNamespaceImpl, EventHubsManager> implements EventHubNamespace, EventHubNamespace.Definition, EventHubNamespace.Update { private Flux<Indexable> postRunTasks; protected EventHubNamespaceImpl(String name, EHNamespaceInn...
Should this be added to the map as well?
public static Region create(String name, String label) { Objects.requireNonNull(name, "'name' cannot be null."); Region region = VALUES_BY_NAME.get(name.toLowerCase(Locale.ROOT)); if (region != null) { return region; } else { return new Region(name, label); } }
return new Region(name, label);
public static Region create(String name, String label) { Objects.requireNonNull(name, "'name' cannot be null."); Region region = VALUES_BY_NAME.get(name.toLowerCase(Locale.ROOT)); if (region != null) { return region; } else { return new Region(name, label); } }
class Region { private static final ConcurrentMap<String, Region> VALUES_BY_NAME = new ConcurrentHashMap<>(); /* * Azure Cloud - Americas */ /** * East US (US) (recommended) */ public static final Region US_EAST = new Region("eastus", "East US"); /** * East US 2 (US) (recommended) */ public static final Region US_EAST2...
class Region { private static final ConcurrentMap<String, Region> VALUES_BY_NAME = new ConcurrentHashMap<>(); /* * Azure Cloud - Americas */ /** * East US (US) (recommended) */ public static final Region US_EAST = new Region("eastus", "East US"); /** * East US 2 (US) (recommended) */ public static final Region US_EAST2...
when we get to the samples code, we will need to read this from the disk.
public static void main(String[] args) throws InterruptedException, JsonProcessingException { String tenantId = System.getenv("TENANT_ID"); String clientId = System.getenv("CLIENT_ID"); String clientSecret = System.getenv("CLIENT_SECRET"); String endpoint = System.getenv("DIGITAL_TWINS_ENDPOINT"); String modelId = "dtm...
String targetTwin_1 = "{\"$metadata\": {\"$model\": \"dtmi:samples:HVAC;1\"}, \"Efficiency\": 10, \"TargetTemperature\": 10, \"TargetHumidity\": 10}";
public static void main(String[] args) throws InterruptedException, JsonProcessingException { String tenantId = System.getenv("TENANT_ID"); String clientId = System.getenv("CLIENT_ID"); String clientSecret = System.getenv("CLIENT_SECRET"); String endpoint = System.getenv("DIGITAL_TWINS_ENDPOINT"); String modelId = "dtm...
class AsyncSample { private static final ObjectMapper mapper = new ObjectMapper(); private static final Random random = new Random(); }
class AsyncSample { private static final ObjectMapper mapper = new ObjectMapper(); private static final Random random = new Random(); }
Yes, that's correct.
public static void main(String[] args) throws InterruptedException, JsonProcessingException { String tenantId = System.getenv("TENANT_ID"); String clientId = System.getenv("CLIENT_ID"); String clientSecret = System.getenv("CLIENT_SECRET"); String endpoint = System.getenv("DIGITAL_TWINS_ENDPOINT"); String modelId = "dtm...
String targetTwin_1 = "{\"$metadata\": {\"$model\": \"dtmi:samples:HVAC;1\"}, \"Efficiency\": 10, \"TargetTemperature\": 10, \"TargetHumidity\": 10}";
public static void main(String[] args) throws InterruptedException, JsonProcessingException { String tenantId = System.getenv("TENANT_ID"); String clientId = System.getenv("CLIENT_ID"); String clientSecret = System.getenv("CLIENT_SECRET"); String endpoint = System.getenv("DIGITAL_TWINS_ENDPOINT"); String modelId = "dtm...
class AsyncSample { private static final ObjectMapper mapper = new ObjectMapper(); private static final Random random = new Random(); }
class AsyncSample { private static final ObjectMapper mapper = new ObjectMapper(); private static final Random random = new Random(); }
Why not define `listModelOptions.getDependenciesFor` as a List to begin with? If the PL is restrictive, then any advantage in the public API being flexible? Is there a risk of running into conversion errors by simply casting it to a List -> would a for-each loop be better: https://www.baeldung.com/java-iterable-to-col...
Mono<PagedResponse<ModelData>> listModelsSinglePageAsync(ListModelOptions listModelOptions, Context context){ return protocolLayer.getDigitalTwinModels().listSinglePageAsync( (List<String>) listModelOptions.getDependenciesFor(), listModelOptions.getIncludeModelDefinition(), new DigitalTwinModelsListOptions().setMaxItem...
(List<String>) listModelOptions.getDependenciesFor(),
new DigitalTwinModelsListOptions().setMaxItemCount(listModelOptions.getMaxItemCount()), context); } Mono<PagedResponse<ModelData>> listModelsNextSinglePageAsync(String nextLink, Context context){ return protocolLayer.getDigitalTwinModels().listNextSinglePageAsync(nextLink, context); }
class DigitalTwinsAsyncClient { private static final ClientLogger logger = new ClientLogger(DigitalTwinsAsyncClient.class); private static final ObjectMapper mapper = new ObjectMapper(); private final DigitalTwinsServiceVersion serviceVersion; private final AzureDigitalTwinsAPIImpl protocolLayer; private static final B...
class DigitalTwinsAsyncClient { private static final ClientLogger logger = new ClientLogger(DigitalTwinsAsyncClient.class); private static final ObjectMapper mapper = new ObjectMapper(); private final DigitalTwinsServiceVersion serviceVersion; private final AzureDigitalTwinsAPIImpl protocolLayer; private static final B...
I think so too, I will change all the types back to List since that is the input the protocol layer accepts and I don't see a point in going more generic than that
Mono<PagedResponse<ModelData>> listModelsSinglePageAsync(ListModelOptions listModelOptions, Context context){ return protocolLayer.getDigitalTwinModels().listSinglePageAsync( (List<String>) listModelOptions.getDependenciesFor(), listModelOptions.getIncludeModelDefinition(), new DigitalTwinModelsListOptions().setMaxItem...
(List<String>) listModelOptions.getDependenciesFor(),
new DigitalTwinModelsListOptions().setMaxItemCount(listModelOptions.getMaxItemCount()), context); } Mono<PagedResponse<ModelData>> listModelsNextSinglePageAsync(String nextLink, Context context){ return protocolLayer.getDigitalTwinModels().listNextSinglePageAsync(nextLink, context); }
class DigitalTwinsAsyncClient { private static final ClientLogger logger = new ClientLogger(DigitalTwinsAsyncClient.class); private static final ObjectMapper mapper = new ObjectMapper(); private final DigitalTwinsServiceVersion serviceVersion; private final AzureDigitalTwinsAPIImpl protocolLayer; private static final B...
class DigitalTwinsAsyncClient { private static final ClientLogger logger = new ClientLogger(DigitalTwinsAsyncClient.class); private static final ObjectMapper mapper = new ObjectMapper(); private final DigitalTwinsServiceVersion serviceVersion; private final AzureDigitalTwinsAPIImpl protocolLayer; private static final B...
So is this treated as empty?
public static void main(String[] args) throws JsonProcessingException { String tenantId = System.getenv("TENANT_ID"); String clientId = System.getenv("CLIENT_ID"); String clientSecret = System.getenv("CLIENT_SECRET"); String endpoint = System.getenv("DIGITAL_TWINS_ENDPOINT"); String sourceDigitalTwinId = System.getenv(...
String createdRelationship = client.createRelationshipWithResponse(sourceDigitalTwinId, relationshipId, relationship, Context.NONE).getValue();
public static void main(String[] args) throws JsonProcessingException { String tenantId = System.getenv("TENANT_ID"); String clientId = System.getenv("CLIENT_ID"); String clientSecret = System.getenv("CLIENT_SECRET"); String endpoint = System.getenv("DIGITAL_TWINS_ENDPOINT"); String sourceDigitalTwinId = System.getenv(...
class SyncSample { }
class SyncSample { }
yes `public static final Context NONE = new Context((Context)null, (Object)null, (Object)null);`
public static void main(String[] args) throws JsonProcessingException { String tenantId = System.getenv("TENANT_ID"); String clientId = System.getenv("CLIENT_ID"); String clientSecret = System.getenv("CLIENT_SECRET"); String endpoint = System.getenv("DIGITAL_TWINS_ENDPOINT"); String sourceDigitalTwinId = System.getenv(...
String createdRelationship = client.createRelationshipWithResponse(sourceDigitalTwinId, relationshipId, relationship, Context.NONE).getValue();
public static void main(String[] args) throws JsonProcessingException { String tenantId = System.getenv("TENANT_ID"); String clientId = System.getenv("CLIENT_ID"); String clientSecret = System.getenv("CLIENT_SECRET"); String endpoint = System.getenv("DIGITAL_TWINS_ENDPOINT"); String sourceDigitalTwinId = System.getenv(...
class SyncSample { }
class SyncSample { }
The placeholder for these is `{}` rather than `%s`
private Object getEntityFieldAsObject(JsonNode parentNode, String fieldName) { JsonNode valueNode = parentNode.get(fieldName); if (!TablesConstants.METADATA_KEYS.contains(fieldName) && !fieldName.endsWith("@odata.type")) { JsonNode typeNode = parentNode.get(fieldName + "@odata.type"); if (typeNode != null) { String typ...
default:
private Object getEntityFieldAsObject(JsonNode parentNode, String fieldName) { JsonNode valueNode = parentNode.get(fieldName); if (!TablesConstants.METADATA_KEYS.contains(fieldName) && !fieldName.endsWith("@odata.type")) { JsonNode typeNode = parentNode.get(fieldName + "@odata.type"); if (typeNode != null) { String typ...
class TablesJacksonSerializer extends JacksonAdapter { private final ClientLogger logger = new ClientLogger(TablesJacksonSerializer.class); @Override public <U> U deserialize(String value, Type type, SerializerEncoding serializerEncoding) throws IOException { if (type == TableEntityQueryResponse.class) { return deseria...
class TablesJacksonSerializer extends JacksonAdapter { private final ClientLogger logger = new ClientLogger(TablesJacksonSerializer.class); @Override public <U> U deserialize(String value, Type type, SerializerEncoding serializerEncoding) throws IOException { if (type == TableEntityQueryResponse.class) { return deseria...
You can use the following, this is like Task.whenAll that completes when all three are done. ```java Mono.when( tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue)), tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue2)), tableClient.createEntity(new TableEntity(part...
void listEntitiesWithTopAsync() { final String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue2 = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue3 = testResourceNamer.randomName("ro...
tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue)).block(TIMEOUT);
void listEntitiesWithTopAsync() { final String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue2 = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue3 = testResourceNamer.randomName("ro...
class TablesAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(30); private TableAsyncClient tableClient; private HttpPipelinePolicy recordPolicy; private HttpClient playbackClient; @Override protected void beforeTest() { final String tableName = testResourceNamer.randomName("...
class TablesAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(30); private TableAsyncClient tableClient; private HttpPipelinePolicy recordPolicy; private HttpClient playbackClient; @Override protected void beforeTest() { final String tableName = testResourceNamer.randomName("...
Same with those other instances.
void listEntitiesWithTopAsync() { final String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue2 = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue3 = testResourceNamer.randomName("ro...
tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue)).block(TIMEOUT);
void listEntitiesWithTopAsync() { final String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue2 = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue3 = testResourceNamer.randomName("ro...
class TablesAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(30); private TableAsyncClient tableClient; private HttpPipelinePolicy recordPolicy; private HttpClient playbackClient; @Override protected void beforeTest() { final String tableName = testResourceNamer.randomName("...
class TablesAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(30); private TableAsyncClient tableClient; private HttpPipelinePolicy recordPolicy; private HttpClient playbackClient; @Override protected void beforeTest() { final String tableName = testResourceNamer.randomName("...
Fixed.
private Object getEntityFieldAsObject(JsonNode parentNode, String fieldName) { JsonNode valueNode = parentNode.get(fieldName); if (!TablesConstants.METADATA_KEYS.contains(fieldName) && !fieldName.endsWith("@odata.type")) { JsonNode typeNode = parentNode.get(fieldName + "@odata.type"); if (typeNode != null) { String typ...
default:
private Object getEntityFieldAsObject(JsonNode parentNode, String fieldName) { JsonNode valueNode = parentNode.get(fieldName); if (!TablesConstants.METADATA_KEYS.contains(fieldName) && !fieldName.endsWith("@odata.type")) { JsonNode typeNode = parentNode.get(fieldName + "@odata.type"); if (typeNode != null) { String typ...
class TablesJacksonSerializer extends JacksonAdapter { private final ClientLogger logger = new ClientLogger(TablesJacksonSerializer.class); @Override public <U> U deserialize(String value, Type type, SerializerEncoding serializerEncoding) throws IOException { if (type == TableEntityQueryResponse.class) { return deseria...
class TablesJacksonSerializer extends JacksonAdapter { private final ClientLogger logger = new ClientLogger(TablesJacksonSerializer.class); @Override public <U> U deserialize(String value, Type type, SerializerEncoding serializerEncoding) throws IOException { if (type == TableEntityQueryResponse.class) { return deseria...
Fixed
void listEntitiesWithTopAsync() { final String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue2 = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue3 = testResourceNamer.randomName("ro...
tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue)).block(TIMEOUT);
void listEntitiesWithTopAsync() { final String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue2 = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue3 = testResourceNamer.randomName("ro...
class TablesAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(30); private TableAsyncClient tableClient; private HttpPipelinePolicy recordPolicy; private HttpClient playbackClient; @Override protected void beforeTest() { final String tableName = testResourceNamer.randomName("...
class TablesAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(30); private TableAsyncClient tableClient; private HttpPipelinePolicy recordPolicy; private HttpClient playbackClient; @Override protected void beforeTest() { final String tableName = testResourceNamer.randomName("...
Why none? Don't we have some parameter user's set?
public ServiceBusReceiverAsyncClient buildAsyncClient() { final MessagingEntityType entityType = validateEntityPaths(logger, connectionStringEntityName, topicName, queueName); final String entityPath = getEntityPath(logger, entityType, queueName, topicName, subscriptionName, SubQueue.NONE); validateAndThrow(prefetchCou...
SubQueue.NONE);
public ServiceBusReceiverAsyncClient buildAsyncClient() { final MessagingEntityType entityType = validateEntityPaths(logger, connectionStringEntityName, topicName, queueName); final String entityPath = getEntityPath(logger, entityType, queueName, topicName, subscriptionName, SubQueue.NONE); validateAndThrow(prefetchCou...
class ServiceBusSessionReceiverClientBuilder { private Integer maxConcurrentSessions = null; private int prefetchCount = DEFAULT_PREFETCH_COUNT; private String queueName; private ReceiveMode receiveMode = ReceiveMode.PEEK_LOCK; private String sessionId; private String subscriptionName; private String topicName; private...
class ServiceBusSessionReceiverClientBuilder { private Integer maxConcurrentSessions = null; private int prefetchCount = DEFAULT_PREFETCH_COUNT; private String queueName; private ReceiveMode receiveMode = ReceiveMode.PEEK_LOCK; private String sessionId; private String subscriptionName; private String topicName; private...
`final Long[] longs` to be consistent.
public Mono<Void> cancelScheduledMessages(Iterable<Long> sequenceNumbers, String associatedLinkName) { return isAuthorized(ManagementConstants.OPERATION_CANCEL_SCHEDULED_MESSAGE) .then(createChannel.flatMap(channel -> { final Message requestMessage = createManagementMessage( ManagementConstants.OPERATION_CANCEL_SCHEDUL...
Long[] longs = numbers.toArray(new Long[0]);
public Mono<Void> cancelScheduledMessages(Iterable<Long> sequenceNumbers, String associatedLinkName) { return isAuthorized(ManagementConstants.OPERATION_CANCEL_SCHEDULED_MESSAGE) .then(createChannel.flatMap(channel -> { final Message requestMessage = createManagementMessage( ManagementConstants.OPERATION_CANCEL_SCHEDUL...
class ManagementChannel implements ServiceBusManagementNode { private final MessageSerializer messageSerializer; private final TokenManager tokenManager; private final Duration operationTimeout; private final Mono<RequestResponseChannel> createChannel; private final String fullyQualifiedNamespace; private final ClientL...
class ManagementChannel implements ServiceBusManagementNode { private final MessageSerializer messageSerializer; private final TokenManager tokenManager; private final Duration operationTimeout; private final Mono<RequestResponseChannel> createChannel; private final String fullyQualifiedNamespace; private final ClientL...
Why duplicate logic, the logic in cancel and with iterable and single item are exactly the same.
public Mono<Void> cancelScheduledMessages(Iterable<Long> sequenceNumbers, String associatedLinkName) { return isAuthorized(ManagementConstants.OPERATION_CANCEL_SCHEDULED_MESSAGE) .then(createChannel.flatMap(channel -> { final Message requestMessage = createManagementMessage( ManagementConstants.OPERATION_CANCEL_SCHEDUL...
return isAuthorized(ManagementConstants.OPERATION_CANCEL_SCHEDULED_MESSAGE)
public Mono<Void> cancelScheduledMessages(Iterable<Long> sequenceNumbers, String associatedLinkName) { return isAuthorized(ManagementConstants.OPERATION_CANCEL_SCHEDULED_MESSAGE) .then(createChannel.flatMap(channel -> { final Message requestMessage = createManagementMessage( ManagementConstants.OPERATION_CANCEL_SCHEDUL...
class ManagementChannel implements ServiceBusManagementNode { private final MessageSerializer messageSerializer; private final TokenManager tokenManager; private final Duration operationTimeout; private final Mono<RequestResponseChannel> createChannel; private final String fullyQualifiedNamespace; private final ClientL...
class ManagementChannel implements ServiceBusManagementNode { private final MessageSerializer messageSerializer; private final TokenManager tokenManager; private final Duration operationTimeout; private final Mono<RequestResponseChannel> createChannel; private final String fullyQualifiedNamespace; private final ClientL...
Any sub queue are accessed via non-session receiver, confirmed with dotnet also. Thus we are not exposing `subQueue()` in session receiver builder. That is why I am passing NONE.
public ServiceBusReceiverAsyncClient buildAsyncClient() { final MessagingEntityType entityType = validateEntityPaths(logger, connectionStringEntityName, topicName, queueName); final String entityPath = getEntityPath(logger, entityType, queueName, topicName, subscriptionName, SubQueue.NONE); validateAndThrow(prefetchCou...
SubQueue.NONE);
public ServiceBusReceiverAsyncClient buildAsyncClient() { final MessagingEntityType entityType = validateEntityPaths(logger, connectionStringEntityName, topicName, queueName); final String entityPath = getEntityPath(logger, entityType, queueName, topicName, subscriptionName, SubQueue.NONE); validateAndThrow(prefetchCou...
class ServiceBusSessionReceiverClientBuilder { private Integer maxConcurrentSessions = null; private int prefetchCount = DEFAULT_PREFETCH_COUNT; private String queueName; private ReceiveMode receiveMode = ReceiveMode.PEEK_LOCK; private String sessionId; private String subscriptionName; private String topicName; private...
class ServiceBusSessionReceiverClientBuilder { private Integer maxConcurrentSessions = null; private int prefetchCount = DEFAULT_PREFETCH_COUNT; private String queueName; private ReceiveMode receiveMode = ReceiveMode.PEEK_LOCK; private String sessionId; private String subscriptionName; private String topicName; private...
use more descriptive variable names instead of `e` and `p`.
public static void main(final String[] args) throws IOException { String endpoint = "<anomaly-detector-resource-endpoint>"; String key = "<anomaly-detector-resource-key>"; HttpHeaders headers = new HttpHeaders() .put("Accept", ContentType.APPLICATION_JSON); HttpPipelinePolicy authPolicy = new AzureKeyCredentialPolicy("...
})
public static void main(final String[] args) throws IOException { String endpoint = "<anomaly-detector-resource-endpoint>"; String key = "<anomaly-detector-resource-key>"; HttpHeaders headers = new HttpHeaders() .put("Accept", ContentType.APPLICATION_JSON); HttpPipelinePolicy authPolicy = new AzureKeyCredentialPolicy("...
class DetectAnomaliesEntireSeries { }
class DetectAnomaliesEntireSeries { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. * @throws IOException Exception thrown when there is an error in reading all the lines from the csv file. */ }
It would be good to add comments to describe what is happening in the samples to help the users follow the sample better.
public static void main(final String[] args) throws IOException { String endpoint = "<anomaly-detector-resource-endpoint>"; String key = "<anomaly-detector-resource-key>"; HttpHeaders headers = new HttpHeaders() .put("Accept", ContentType.APPLICATION_JSON); HttpPipelinePolicy authPolicy = new AzureKeyCredentialPolicy("...
List<TimeSeriesPoint> series = requestData.stream()
public static void main(final String[] args) throws IOException { String endpoint = "<anomaly-detector-resource-endpoint>"; String key = "<anomaly-detector-resource-key>"; HttpHeaders headers = new HttpHeaders() .put("Accept", ContentType.APPLICATION_JSON); HttpPipelinePolicy authPolicy = new AzureKeyCredentialPolicy("...
class DetectChangePoints { }
class DetectChangePoints { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. * @throws IOException Exception thrown when there is an error in reading all the lines from the csv file. */ }
The multi nested if loops is hard to reason about.. is it possible to flatten it and return early? ```java if (TablesConstants.METADATA_KEYS.contains(fieldName) .... ) { return valueNode.asText(); } ```
private Object getEntityFieldAsObject(JsonNode parentNode, String fieldName) { JsonNode valueNode = parentNode.get(fieldName); if (!TablesConstants.METADATA_KEYS.contains(fieldName) && !fieldName.endsWith(TablesConstants.ODATA_TYPE_KEY_SUFFIX)) { JsonNode typeNode = parentNode.get(fieldName + TablesConstants.ODATA_TYPE...
if (!TablesConstants.METADATA_KEYS.contains(fieldName)
private Object getEntityFieldAsObject(JsonNode parentNode, String fieldName) throws IOException { JsonNode valueNode = parentNode.get(fieldName); if (TablesConstants.METADATA_KEYS.contains(fieldName) || fieldName.endsWith(TablesConstants.ODATA_TYPE_KEY_SUFFIX)) { return serializer().treeToValue(valueNode, Object.class)...
class TablesJacksonSerializer extends JacksonAdapter { private final ClientLogger logger = new ClientLogger(TablesJacksonSerializer.class); @Override public <U> U deserialize(String value, Type type, SerializerEncoding serializerEncoding) throws IOException { if (type == TableEntityQueryResponse.class) { return deseria...
class TablesJacksonSerializer extends JacksonAdapter { private final ClientLogger logger = new ClientLogger(TablesJacksonSerializer.class); @Override public void serialize(Object object, SerializerEncoding encoding, OutputStream outputStream) throws IOException { if (object instanceof Map) { super.serialize(insertTypeP...
Fixed
private Object getEntityFieldAsObject(JsonNode parentNode, String fieldName) { JsonNode valueNode = parentNode.get(fieldName); if (!TablesConstants.METADATA_KEYS.contains(fieldName) && !fieldName.endsWith(TablesConstants.ODATA_TYPE_KEY_SUFFIX)) { JsonNode typeNode = parentNode.get(fieldName + TablesConstants.ODATA_TYPE...
if (!TablesConstants.METADATA_KEYS.contains(fieldName)
private Object getEntityFieldAsObject(JsonNode parentNode, String fieldName) throws IOException { JsonNode valueNode = parentNode.get(fieldName); if (TablesConstants.METADATA_KEYS.contains(fieldName) || fieldName.endsWith(TablesConstants.ODATA_TYPE_KEY_SUFFIX)) { return serializer().treeToValue(valueNode, Object.class)...
class TablesJacksonSerializer extends JacksonAdapter { private final ClientLogger logger = new ClientLogger(TablesJacksonSerializer.class); @Override public <U> U deserialize(String value, Type type, SerializerEncoding serializerEncoding) throws IOException { if (type == TableEntityQueryResponse.class) { return deseria...
class TablesJacksonSerializer extends JacksonAdapter { private final ClientLogger logger = new ClientLogger(TablesJacksonSerializer.class); @Override public void serialize(Object object, SerializerEncoding encoding, OutputStream outputStream) throws IOException { if (object instanceof Map) { super.serialize(insertTypeP...
Can you add tests for the new `offset` and `length` properties?
public int getLength() { return length; }
return length;
public int getLength() { return length; }
class SentenceSentiment { private final String text; private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; private final IterableStream<MinedOpinion> minedOpinions; private final int offset; private final int length; /** * Creates a {@link SentenceSentiment} model that describ...
class SentenceSentiment { private final String text; private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; private final IterableStream<MinedOpinion> minedOpinions; private final int offset; private final int length; /** * Creates a {@link SentenceSentiment} model that describ...
All tests that verifying the `SentenceSentiment` has verifying the offset and length. See https://github.com/Azure/azure-sdk-for-java/pull/14599/files/8f914029e29ac9d387803cc94f8db120ed7fcaba#diff-6152e7741d610810c960c85cfc56fbc2R361
public int getLength() { return length; }
return length;
public int getLength() { return length; }
class SentenceSentiment { private final String text; private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; private final IterableStream<MinedOpinion> minedOpinions; private final int offset; private final int length; /** * Creates a {@link SentenceSentiment} model that describ...
class SentenceSentiment { private final String text; private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; private final IterableStream<MinedOpinion> minedOpinions; private final int offset; private final int length; /** * Creates a {@link SentenceSentiment} model that describ...
Oh I'm so sorry I don't know how I totally missed those tests
public int getLength() { return length; }
return length;
public int getLength() { return length; }
class SentenceSentiment { private final String text; private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; private final IterableStream<MinedOpinion> minedOpinions; private final int offset; private final int length; /** * Creates a {@link SentenceSentiment} model that describ...
class SentenceSentiment { private final String text; private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; private final IterableStream<MinedOpinion> minedOpinions; private final int offset; private final int length; /** * Creates a {@link SentenceSentiment} model that describ...
As discussed, to fail early with a better error message, added the check here to throw if both port and redirectUrl are specified.
public InteractiveBrowserCredential build() { ValidationUtil.validate(getClass().getSimpleName(), new HashMap<String, Object>() {{ put("clientId", clientId); }}); return new InteractiveBrowserCredential(clientId, tenantId, port, redirectURL, automaticAuthentication, identityClientOptions); }
return new InteractiveBrowserCredential(clientId, tenantId, port, redirectURL, automaticAuthentication,
public InteractiveBrowserCredential build() { ValidationUtil.validateInteractiveBrowserRedirectUrlSetup(getClass().getSimpleName(), port, redirectUrl); ValidationUtil.validate(getClass().getSimpleName(), new HashMap<String, Object>() {{ put("clientId", clientId); }}); return new InteractiveBrowserCredential(clientId, t...
class InteractiveBrowserCredentialBuilder extends AadCredentialBuilderBase<InteractiveBrowserCredentialBuilder> { private Integer port; private boolean automaticAuthentication = true; private String redirectURL; /** * Sets the port for the local HTTP server, for which {@code http: * registered as a valid reply URL on t...
class InteractiveBrowserCredentialBuilder extends AadCredentialBuilderBase<InteractiveBrowserCredentialBuilder> { private Integer port; private boolean automaticAuthentication = true; private String redirectUrl; /** * Sets the port for the local HTTP server, for which {@code http: * registered as a valid reply URL on t...
No worries. Thank you for reviewing the PR.
public int getLength() { return length; }
return length;
public int getLength() { return length; }
class SentenceSentiment { private final String text; private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; private final IterableStream<MinedOpinion> minedOpinions; private final int offset; private final int length; /** * Creates a {@link SentenceSentiment} model that describ...
class SentenceSentiment { private final String text; private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; private final IterableStream<MinedOpinion> minedOpinions; private final int offset; private final int length; /** * Creates a {@link SentenceSentiment} model that describ...
These initializations are only on SentenceSentiment and not on `LinkedEntityMatch` or `CategorizedEntity` ?
public SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores) { this.text = text; this.sentiment = sentiment; this.confidenceScores = confidenceScores; this.minedOpinions = null; this.offset = 0; this.length = 0; }
this.length = 0;
public SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores) { this.text = text; this.sentiment = sentiment; this.confidenceScores = confidenceScores; this.minedOpinions = null; this.offset = 0; this.length = 0; }
class SentenceSentiment { private final String text; private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; private final IterableStream<MinedOpinion> minedOpinions; private final int offset; private final int length; /** * Creates a {@link SentenceSentiment} model that describ...
class SentenceSentiment { private final String text; private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; private final IterableStream<MinedOpinion> minedOpinions; private final int offset; private final int length; /** * Creates a {@link SentenceSentiment} model that describ...
we do have in LinkedEntityMatch: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntityMatch.java#L44 and CategorizedEntity: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanal...
public SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores) { this.text = text; this.sentiment = sentiment; this.confidenceScores = confidenceScores; this.minedOpinions = null; this.offset = 0; this.length = 0; }
this.length = 0;
public SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores) { this.text = text; this.sentiment = sentiment; this.confidenceScores = confidenceScores; this.minedOpinions = null; this.offset = 0; this.length = 0; }
class SentenceSentiment { private final String text; private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; private final IterableStream<MinedOpinion> minedOpinions; private final int offset; private final int length; /** * Creates a {@link SentenceSentiment} model that describ...
class SentenceSentiment { private final String text; private final TextSentiment sentiment; private final SentimentConfidenceScores confidenceScores; private final IterableStream<MinedOpinion> minedOpinions; private final int offset; private final int length; /** * Creates a {@link SentenceSentiment} model that describ...
Should this error also apply to service principal authentication as well? I'm not familiar enough with the IntelliJ plug-in, but can you authenticate a service principal in an ADFS instance? Does it not try to actually authenticate the SP, but rather just store the credentials?
public Mono<MsalToken> authenticateWithIntelliJ(TokenRequestContext request) { try { IntelliJCacheAccessor cacheAccessor = new IntelliJCacheAccessor(options.getIntelliJKeePassDatabasePath()); IntelliJAuthMethodDetails authDetails = cacheAccessor.getAuthDetailsIfAvailable(); String authType = authDetails.getAuthMethod()...
+ "authentication unavailable. ADFS tenant/authorities are not supported."));
public Mono<MsalToken> authenticateWithIntelliJ(TokenRequestContext request) { try { IntelliJCacheAccessor cacheAccessor = new IntelliJCacheAccessor(options.getIntelliJKeePassDatabasePath()); IntelliJAuthMethodDetails authDetails = cacheAccessor.getAuthDetailsIfAvailable(); String authType = authDetails.getAuthMethod()...
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 ...
So, the IDE Azure Plugin auth with SP won't succeed as the IDE Plugin passes in invalid resources in the request for the Az Stack. But, the service principal details will get stored in the filesystem and if used via the IntelliJCredential with correct scopes specified, it works fine against Az Stack.
public Mono<MsalToken> authenticateWithIntelliJ(TokenRequestContext request) { try { IntelliJCacheAccessor cacheAccessor = new IntelliJCacheAccessor(options.getIntelliJKeePassDatabasePath()); IntelliJAuthMethodDetails authDetails = cacheAccessor.getAuthDetailsIfAvailable(); String authType = authDetails.getAuthMethod()...
+ "authentication unavailable. ADFS tenant/authorities are not supported."));
public Mono<MsalToken> authenticateWithIntelliJ(TokenRequestContext request) { try { IntelliJCacheAccessor cacheAccessor = new IntelliJCacheAccessor(options.getIntelliJKeePassDatabasePath()); IntelliJAuthMethodDetails authDetails = cacheAccessor.getAuthDetailsIfAvailable(); String authType = authDetails.getAuthMethod()...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
class IdentityClient { private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); private static final Random RANDOM = new Random(); private static final String WINDOWS_STARTER = "cmd.exe"; private static final String LINUX_MAC_STARTER = "/bin/sh"; private static final ...
It's an interesting definition of "Works Fine", but I suppose we don't need to artificially guard against it.
public Mono<MsalToken> authenticateWithIntelliJ(TokenRequestContext request) { try { IntelliJCacheAccessor cacheAccessor = new IntelliJCacheAccessor(options.getIntelliJKeePassDatabasePath()); IntelliJAuthMethodDetails authDetails = cacheAccessor.getAuthDetailsIfAvailable(); String authType = authDetails.getAuthMethod()...
+ "authentication unavailable. ADFS tenant/authorities are not supported."));
public Mono<MsalToken> authenticateWithIntelliJ(TokenRequestContext request) { try { IntelliJCacheAccessor cacheAccessor = new IntelliJCacheAccessor(options.getIntelliJKeePassDatabasePath()); IntelliJAuthMethodDetails authDetails = cacheAccessor.getAuthDetailsIfAvailable(); String authType = authDetails.getAuthMethod()...
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 ...
What if the `redirectUrl` contains a port already? Should we throw here is both `port` and `redirectUrl` are specified?
public InteractiveBrowserCredential build() { ValidationUtil.validate(getClass().getSimpleName(), new HashMap<String, Object>() {{ put("clientId", clientId); }}); return new InteractiveBrowserCredential(clientId, tenantId, port, redirectURL, automaticAuthentication, identityClientOptions); }
return new InteractiveBrowserCredential(clientId, tenantId, port, redirectURL, automaticAuthentication,
public InteractiveBrowserCredential build() { ValidationUtil.validateInteractiveBrowserRedirectUrlSetup(getClass().getSimpleName(), port, redirectUrl); ValidationUtil.validate(getClass().getSimpleName(), new HashMap<String, Object>() {{ put("clientId", clientId); }}); return new InteractiveBrowserCredential(clientId, t...
class InteractiveBrowserCredentialBuilder extends AadCredentialBuilderBase<InteractiveBrowserCredentialBuilder> { private Integer port; private boolean automaticAuthentication = true; private String redirectURL; /** * Sets the port for the local HTTP server, for which {@code http: * registered as a valid reply URL on t...
class InteractiveBrowserCredentialBuilder extends AadCredentialBuilderBase<InteractiveBrowserCredentialBuilder> { private Integer port; private boolean automaticAuthentication = true; private String redirectUrl; /** * Sets the port for the local HTTP server, for which {@code http: * registered as a valid reply URL on t...
Yeah, since Service Principal auth is supported against Az Stack from the credential, we don't need to guard against it. It'll be a rare scenario for the user to take this route.
public Mono<MsalToken> authenticateWithIntelliJ(TokenRequestContext request) { try { IntelliJCacheAccessor cacheAccessor = new IntelliJCacheAccessor(options.getIntelliJKeePassDatabasePath()); IntelliJAuthMethodDetails authDetails = cacheAccessor.getAuthDetailsIfAvailable(); String authType = authDetails.getAuthMethod()...
+ "authentication unavailable. ADFS tenant/authorities are not supported."));
public Mono<MsalToken> authenticateWithIntelliJ(TokenRequestContext request) { try { IntelliJCacheAccessor cacheAccessor = new IntelliJCacheAccessor(options.getIntelliJKeePassDatabasePath()); IntelliJAuthMethodDetails authDetails = cacheAccessor.getAuthDetailsIfAvailable(); String authType = authDetails.getAuthMethod()...
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 ...
can be a map instead
public Mono<String> getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath) .flatMap(response -> Mono.justOrEmpty(response.getValue())); }
.flatMap(response -> Mono.justOrEmpty(response.getValue()));
public Mono<String> getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath) .map(DigitalTwinsResponse::getValue); }
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @return A {@link PagedFlux}
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @return A {@link PagedFlux}
space between `if` and `(`?
protected DigitalTwinsClientBuilder getDigitalTwinsClientBuilder(){ DigitalTwinsClientBuilder builder = new DigitalTwinsClientBuilder() .endpoint(DIGITALTWINS_URL) .tokenCredential(new ClientSecretCredentialBuilder() .tenantId(TENANT_ID) .clientId(CLIENT_ID) .clientSecret(CLIENT_SECRET) .build()); if(interceptorManager...
if(interceptorManager.isPlaybackMode()){
protected DigitalTwinsClientBuilder getDigitalTwinsClientBuilder() { DigitalTwinsClientBuilder builder = new DigitalTwinsClientBuilder() .endpoint(DIGITALTWINS_URL); if (interceptorManager.isPlaybackMode()){ builder.httpClient(interceptorManager.getPlaybackClient()); builder.tokenCredential(new FakeCredentials()); retu...
class DigitalTwinsTestBase extends TestBase { protected static final String TENANT_ID = Configuration.getGlobalConfiguration() .get("TENANT_ID", "tenantId"); protected static final String CLIENT_SECRET = Configuration.getGlobalConfiguration() .get("CLIENT_SECRET", "clientSecret"); protected static final String CLIENT_I...
class DigitalTwinsTestBase extends TestBase { protected static final String TENANT_ID = Configuration.getGlobalConfiguration() .get("TENANT_ID", "tenantId"); protected static final String CLIENT_SECRET = Configuration.getGlobalConfiguration() .get("CLIENT_SECRET", "clientSecret"); protected static final String CLIENT_I...
```java .map(DigitalTwinsResponse::getValue); ```
public Mono<String> getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath) .flatMap(response -> Mono.justOrEmpty(response.getValue())); }
.flatMap(response -> Mono.justOrEmpty(response.getValue()));
public Mono<String> getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath) .map(DigitalTwinsResponse::getValue); }
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @return A {@link PagedFlux}
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @return A {@link PagedFlux}
Use `p.getName().orElse("")` instead of `p.getName().get()` to avoid NPE.
public Object execute(final Object[] parameters) { final ReactiveCosmosParameterAccessor accessor = new ReactiveCosmosParameterParameterAccessor(getQueryMethod(), parameters); final ResultProcessor processor = getQueryMethod().getResultProcessor().withDynamicProjection(accessor); List<SqlParameter> sqlParameters = getQ...
.map(p -> new SqlParameter("@" + p.getName().get(),
public Object execute(final Object[] parameters) { final ReactiveCosmosParameterAccessor accessor = new ReactiveCosmosParameterParameterAccessor(getQueryMethod(), parameters); final ResultProcessor processor = getQueryMethod().getResultProcessor().withDynamicProjection(accessor); List<SqlParameter> sqlParameters = getQ...
class StringBasedReactiveCosmosQuery extends AbstractReactiveCosmosQuery { private final String query; /** * Constructor * @param queryMethod the query method * @param dbOperations the reactive cosmos operations */ public StringBasedReactiveCosmosQuery(ReactiveCosmosQueryMethod queryMethod, ReactiveCosmosOperations dbO...
class StringBasedReactiveCosmosQuery extends AbstractReactiveCosmosQuery { private final String query; /** * Constructor * @param queryMethod the query method * @param dbOperations the reactive cosmos operations */ public StringBasedReactiveCosmosQuery(ReactiveCosmosQueryMethod queryMethod, ReactiveCosmosOperations dbO...
done
public Object execute(final Object[] parameters) { final ReactiveCosmosParameterAccessor accessor = new ReactiveCosmosParameterParameterAccessor(getQueryMethod(), parameters); final ResultProcessor processor = getQueryMethod().getResultProcessor().withDynamicProjection(accessor); List<SqlParameter> sqlParameters = getQ...
.map(p -> new SqlParameter("@" + p.getName().get(),
public Object execute(final Object[] parameters) { final ReactiveCosmosParameterAccessor accessor = new ReactiveCosmosParameterParameterAccessor(getQueryMethod(), parameters); final ResultProcessor processor = getQueryMethod().getResultProcessor().withDynamicProjection(accessor); List<SqlParameter> sqlParameters = getQ...
class StringBasedReactiveCosmosQuery extends AbstractReactiveCosmosQuery { private final String query; /** * Constructor * @param queryMethod the query method * @param dbOperations the reactive cosmos operations */ public StringBasedReactiveCosmosQuery(ReactiveCosmosQueryMethod queryMethod, ReactiveCosmosOperations dbO...
class StringBasedReactiveCosmosQuery extends AbstractReactiveCosmosQuery { private final String query; /** * Constructor * @param queryMethod the query method * @param dbOperations the reactive cosmos operations */ public StringBasedReactiveCosmosQuery(ReactiveCosmosQueryMethod queryMethod, ReactiveCosmosOperations dbO...
Can we just delete field `method`, use `stringInQueryAnnotation` instead?
public CosmosQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory) { super(method, metadata, factory); this.method = method; }
this.method = method;
public CosmosQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory) { super(method, metadata, factory); this.annotatedQueryValue = findAnnotatedQuery(method).orElse(null); }
class CosmosQueryMethod extends QueryMethod { private CosmosEntityMetadata<?> metadata; final Method method; /** * Creates a new {@link CosmosQueryMethod} from the given parameters. Looks up the correct query to use * for following invocations of the method given. * * @param method must not be {@literal null}. * @param...
class CosmosQueryMethod extends QueryMethod { private CosmosEntityMetadata<?> metadata; private final String annotatedQueryValue; /** * Creates a new {@link CosmosQueryMethod} from the given parameters. Looks up the correct query to use * for following invocations of the method given. * * @param method must not be {@li...
Refactored
public CosmosQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory) { super(method, metadata, factory); this.method = method; }
this.method = method;
public CosmosQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory) { super(method, metadata, factory); this.annotatedQueryValue = findAnnotatedQuery(method).orElse(null); }
class CosmosQueryMethod extends QueryMethod { private CosmosEntityMetadata<?> metadata; final Method method; /** * Creates a new {@link CosmosQueryMethod} from the given parameters. Looks up the correct query to use * for following invocations of the method given. * * @param method must not be {@literal null}. * @param...
class CosmosQueryMethod extends QueryMethod { private CosmosEntityMetadata<?> metadata; private final String annotatedQueryValue; /** * Creates a new {@link CosmosQueryMethod} from the given parameters. Looks up the correct query to use * for following invocations of the method given. * * @param method must not be {@li...
So are these two basically the same then? ```java .map(response -> response.getValue()); ``` ```java .flatMap(response -> Mono.justOrEmpty(response.getValue())); ```
public Mono<String> getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath) .flatMap(response -> Mono.justOrEmpty(response.getValue())); }
.flatMap(response -> Mono.justOrEmpty(response.getValue()));
public Mono<String> getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath) .map(DigitalTwinsResponse::getValue); }
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @return A {@link PagedFlux}
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @return A {@link PagedFlux}
Yes, they are the same. The first one will take the response emitted by the previous Mono, transform it to `.getValue()` and emit the result. The second one will take the response emitted by the previous Mono, transform it into `.getValue()`, put it into a Mono, flatten it and emit the result.
public Mono<String> getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath) .flatMap(response -> Mono.justOrEmpty(response.getValue())); }
.flatMap(response -> Mono.justOrEmpty(response.getValue()));
public Mono<String> getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath) .map(DigitalTwinsResponse::getValue); }
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @return A {@link PagedFlux}
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @return A {@link PagedFlux}