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
So the end result from both of these transformed APIs will be the `.getValue()` items directly.
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}
We've been following the format where the async APIs call the async overloads, and the max overload API calls the PL. Similarly, the sync APIs call the sync overloads, and the max overload sync API calls the async API.
public String getComponent(String digitalTwinId, String componentPath) { return digitalTwinsAsyncClient.getComponent(digitalTwinId, componentPath).block(); }
return digitalTwinsAsyncClient.getComponent(digitalTwinId, componentPath).block();
public String getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath, Context.NONE).getValue(); }
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link PagedIterable}
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link PagedIterable}
nit: this can be replaced by a method reference `.map(DigitalTwinsResponse::getValue)`.
public Mono<String> getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath) .map(response -> response.getValue()); }
.map(response -> 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}
Ha, too slow. I just figured this out while looking at another PR
public Mono<String> getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath) .map(response -> response.getValue()); }
.map(response -> 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}
So I made this change already
public Mono<String> getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath) .map(response -> response.getValue()); }
.map(response -> 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}
Gotcha, I can chain it that way instead
public String getComponent(String digitalTwinId, String componentPath) { return digitalTwinsAsyncClient.getComponent(digitalTwinId, componentPath).block(); }
return digitalTwinsAsyncClient.getComponent(digitalTwinId, componentPath).block();
public String getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath, Context.NONE).getValue(); }
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link PagedIterable}
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link PagedIterable}
Fiyi - for default context you can use `Context.NONE`.
public String getComponent(String digitalTwinId, String componentPath) { return digitalTwinsAsyncClient.getComponent(digitalTwinId, componentPath).block(); }
return digitalTwinsAsyncClient.getComponent(digitalTwinId, componentPath).block();
public String getComponent(String digitalTwinId, String componentPath) { return getComponentWithResponse(digitalTwinId, componentPath, Context.NONE).getValue(); }
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link PagedIterable}
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link PagedIterable}
can be replaced with method reference: ```java .map(Response::getValue); ```
public Mono<ModelData> getModel(String modelId) { return getModelWithResponse(modelId) .map(response -> response.getValue()); }
.map(response -> response.getValue());
public Mono<ModelData> getModel(String modelId) { return getModelWithResponse(modelId) .map(Response::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}
same here as well :)
public Mono<Void> deleteModel(String modelId) { return deleteModelWithResponse(modelId) .map(response -> response.getValue()); }
.map(response -> response.getValue());
public Mono<Void> deleteModel(String modelId) { return deleteModelWithResponse(modelId) .map(Response::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}
you fancy
public Mono<ModelData> getModel(String modelId) { return getModelWithResponse(modelId) .map(response -> response.getValue()); }
.map(response -> response.getValue());
public Mono<ModelData> getModel(String modelId) { return getModelWithResponse(modelId) .map(Response::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}
Doesn't look like there exists a test where we settle with a sessionId.
void settleWithNullTransaction(DispositionStatus dispositionStatus) { ServiceBusTransactionContext nullTransaction = null; when(connection.getManagementNode(ENTITY_PATH, ENTITY_TYPE)).thenReturn(Mono.just(managementNode)); when(managementNode.updateDisposition(any(), eq(dispositionStatus), isNull(), isNull(), isNull(),...
final Mono<Void> operation;
void settleWithNullTransaction(DispositionStatus dispositionStatus) { ServiceBusTransactionContext nullTransaction = null; when(connection.getManagementNode(ENTITY_PATH, ENTITY_TYPE)).thenReturn(Mono.just(managementNode)); when(managementNode.updateDisposition(any(), eq(dispositionStatus), isNull(), isNull(), isNull(),...
class ServiceBusReceiverAsyncClientTest { private static final String PAYLOAD = "hello"; private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8); private static final int PREFETCH = 5; private static final String NAMESPACE = "my-namespace-foo.net"; private static final String ENTITY_PATH = "queue-name"; pri...
class ServiceBusReceiverAsyncClientTest { private static final String PAYLOAD = "hello"; private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8); private static final int PREFETCH = 5; private static final String NAMESPACE = "my-namespace-foo.net"; private static final String ENTITY_PATH = "queue-name"; pri...
method reference here as well -> anywhere we are calling a static method can be replaced by a method reference
Mono<PagedResponse<ModelData>> listModelsSinglePageAsync(ListModelOptions listModelOptions, Context context){ return protocolLayer.getDigitalTwinModels().listSinglePageAsync( listModelOptions.getDependenciesFor(), listModelOptions.getIncludeModelDefinition(), new DigitalTwinModelsListOptions().setMaxItemCount(listModel...
.map(object -> ModelDataConverter.map(object))
new DigitalTwinModelsListOptions().setMaxItemCount(listModelOptions.getMaxItemCount()), context) .map( objectPagedResponse -> { List<ModelData> convertedList = objectPagedResponse.getValue().stream() .map(ModelDataConverter::map) .filter(Objects::nonNull) .collect(Collectors.toList()); return new PagedResponseBase<>( o...
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}
https://docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html
Mono<PagedResponse<ModelData>> listModelsSinglePageAsync(ListModelOptions listModelOptions, Context context){ return protocolLayer.getDigitalTwinModels().listSinglePageAsync( listModelOptions.getDependenciesFor(), listModelOptions.getIncludeModelDefinition(), new DigitalTwinModelsListOptions().setMaxItemCount(listModel...
.map(object -> ModelDataConverter.map(object))
new DigitalTwinModelsListOptions().setMaxItemCount(listModelOptions.getMaxItemCount()), context) .map( objectPagedResponse -> { List<ModelData> convertedList = objectPagedResponse.getValue().stream() .map(ModelDataConverter::map) .filter(Objects::nonNull) .collect(Collectors.toList()); return new PagedResponseBase<>( o...
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}
How to access response status code? `ErrorResponse.getValue().getError().getCode()` is string.
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); final Semaphore deleteTwinsSemaphore = new Semaphore(0); twins .forEach((twinId, twinContent) -> client.deleteDigitalTwin(twinId) ...
if (!(throwable instanceof ErrorResponseException) || !((ErrorResponseException) throwable).getValue().getError().getCode().equals("DigitalTwinNotFound")) {
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); final Semaphore deleteTwinsSemaphore = new Semaphore(0); twins .forEach((twinId, twinContent) -> client.deleteDigitalTwin(twinId) ...
class DigitalTwinsLifecycleSample { private static final ClientLogger logger = new ClientLogger(DigitalTwinsLifecycleSample.class); private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.gete...
class DigitalTwinsLifecycleSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_ENDPOIN...
Can you add a test for domain filter where a returned entity gets filtered out? [Here](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_pii_entities.py#L599) is a python test for taht
public void recognizePiiEntitiesWithRecognizePiiEntityOptions() { textAnalyticsClient.recognizePiiEntities("My SSN is 859-98-0987", "en", new RecognizePiiEntityOptions().setDomainFilter(PiiEntityDomainType.PROTECTED_HEALTH_INFORMATION)) .forEach(entity -> System.out.printf( "Recognized Personally Identifiable Informati...
public void recognizePiiEntitiesWithRecognizePiiEntityOptions() { PiiEntityCollection piiEntityCollection = textAnalyticsClient.recognizePiiEntities( "My SSN is 859-98-0987", "en", new RecognizePiiEntityOptions().setDomainFilter(PiiEntityDomainType.PROTECTED_HEALTH_INFORMATION)); System.out.printf("Redacted Text: %s%n"...
class TextAnalyticsClientJavaDocCodeSnippets { private TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for creating a {@link TextAnalyticsClient} with pipeline */ public void createTextAnalyticsClientWithPipeline() { HttpPipeline pipeline = new HttpPipelineBu...
class TextAnalyticsClientJavaDocCodeSnippets { private TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for creating a {@link TextAnalyticsClient} with pipeline */ public void createTextAnalyticsClientWithPipeline() { HttpPipeline pipeline = new HttpPipelineBu...
There are a few tests for domain filter already in the PR. You are looking at the codesnippet section. https://github.com/Azure/azure-sdk-for-java/pull/14714/files#diff-9df5b3d7d96dd8e2313b619beb609285R509
public void recognizePiiEntitiesWithRecognizePiiEntityOptions() { textAnalyticsClient.recognizePiiEntities("My SSN is 859-98-0987", "en", new RecognizePiiEntityOptions().setDomainFilter(PiiEntityDomainType.PROTECTED_HEALTH_INFORMATION)) .forEach(entity -> System.out.printf( "Recognized Personally Identifiable Informati...
public void recognizePiiEntitiesWithRecognizePiiEntityOptions() { PiiEntityCollection piiEntityCollection = textAnalyticsClient.recognizePiiEntities( "My SSN is 859-98-0987", "en", new RecognizePiiEntityOptions().setDomainFilter(PiiEntityDomainType.PROTECTED_HEALTH_INFORMATION)); System.out.printf("Redacted Text: %s%n"...
class TextAnalyticsClientJavaDocCodeSnippets { private TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for creating a {@link TextAnalyticsClient} with pipeline */ public void createTextAnalyticsClientWithPipeline() { HttpPipeline pipeline = new HttpPipelineBu...
class TextAnalyticsClientJavaDocCodeSnippets { private TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient(); /** * Code snippet for creating a {@link TextAnalyticsClient} with pipeline */ public void createTextAnalyticsClientWithPipeline() { HttpPipeline pipeline = new HttpPipelineBu...
This runnable is executed when the flux completes successfully.
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); final Semaphore deleteTwinsSemaphore = new Semaphore(0); final Semaphore deleteRelationshipsSemaphore = new Semaphore(0); twins .f...
.doOnComplete(deleteRelationshipsSemaphore::release)
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); final Semaphore deleteTwinsSemaphore = new Semaphore(0); twins .forEach((twinId, twinContent) -> client.deleteDigitalTwin(twinId) ...
class DigitalTwinsLifecycleSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_ENDPOIN...
class DigitalTwinsLifecycleSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_ENDPOIN...
I was having intermittent 429 issues with failures when using `Mono.when` with multiple streams against the CosmosDB API.
void serviceListTablesWithTopAsync() { final String tableName = testResourceNamer.randomName("test", 20); final String tableName2 = testResourceNamer.randomName("test", 20); final String tableName3 = testResourceNamer.randomName("test", 20); ListTablesOptions options = new ListTablesOptions().setTop(2); serviceClient.c...
serviceClient.createTable(tableName).block(TIMEOUT);
void serviceListTablesWithTopAsync() { final String tableName = testResourceNamer.randomName("test", 20); final String tableName2 = testResourceNamer.randomName("test", 20); final String tableName3 = testResourceNamer.randomName("test", 20); ListTablesOptions options = new ListTablesOptions().setTop(2); serviceClient.c...
class TableServiceAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(100); private TableServiceAsyncClient serviceClient; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(TIMEOUT); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } @O...
class TableServiceAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(100); private TableServiceAsyncClient serviceClient; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(TIMEOUT); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } @O...
Should we also add this change to the changelog?
Mono<PiiEntityCollection> recognizePiiEntities(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); return recognizePiiEntitiesBatch( Collections.singletonList(new TextDocumentInput("0", document).setLanguage(language)), null) .map(resultCollectionResponse -> { PiiEn...
throw logger.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError()));
Mono<PiiEntityCollection> recognizePiiEntities(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); return recognizePiiEntitiesBatch( Collections.singletonList(new TextDocumentInput("0", document).setLanguage(language)), null) .map(resultCollectionResponse -> { PiiEn...
class RecognizePiiEntityAsyncClient { private final ClientLogger logger = new ClientLogger(RecognizePiiEntityAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create a {@link RecognizePiiEntityAsyncClient} that sends requests to the Text Analytics services's * recognize Personally Identifiable In...
class RecognizePiiEntityAsyncClient { private final ClientLogger logger = new ClientLogger(RecognizePiiEntityAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create a {@link RecognizePiiEntityAsyncClient} that sends requests to the Text Analytics services's * recognize Personally Identifiable In...
? what changes?
Mono<PiiEntityCollection> recognizePiiEntities(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); return recognizePiiEntitiesBatch( Collections.singletonList(new TextDocumentInput("0", document).setLanguage(language)), null) .map(resultCollectionResponse -> { PiiEn...
throw logger.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError()));
Mono<PiiEntityCollection> recognizePiiEntities(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); return recognizePiiEntitiesBatch( Collections.singletonList(new TextDocumentInput("0", document).setLanguage(language)), null) .map(resultCollectionResponse -> { PiiEn...
class RecognizePiiEntityAsyncClient { private final ClientLogger logger = new ClientLogger(RecognizePiiEntityAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create a {@link RecognizePiiEntityAsyncClient} that sends requests to the Text Analytics services's * recognize Personally Identifiable In...
class RecognizePiiEntityAsyncClient { private final ClientLogger logger = new ClientLogger(RecognizePiiEntityAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create a {@link RecognizePiiEntityAsyncClient} that sends requests to the Text Analytics services's * recognize Personally Identifiable In...
Is this the bingEntitySearchApiId ? If yes, then why is the one on L302 different, or just test data?
static List<LinkedEntity> getLinkedEntitiesList1() { final LinkedEntityMatch linkedEntityMatch = new LinkedEntityMatch("Seattle", 0.0, 26, 7); LinkedEntity linkedEntity = new LinkedEntity( "Seattle", new IterableStream<>(Collections.singletonList(linkedEntityMatch)), "en", "Seattle", "https: "Wikipedia", "5fbba6b8-85e1...
"Wikipedia", "5fbba6b8-85e1-4d41-9444-d9055436e473");
static List<LinkedEntity> getLinkedEntitiesList1() { final LinkedEntityMatch linkedEntityMatch = new LinkedEntityMatch("Seattle", 0.0, 26, 7); LinkedEntity linkedEntity = new LinkedEntity( "Seattle", new IterableStream<>(Collections.singletonList(linkedEntityMatch)), "en", "Seattle", "https: "Wikipedia", "5fbba6b8-85e1...
class TestUtils { private static final String DEFAULT_MODEL_VERSION = "2019-10-01"; static final String INVALID_URL = "htttttttps: static final String VALID_HTTPS_LOCALHOST = "https: static final String FAKE_API_KEY = "1234567890"; static final String AZURE_TEXT_ANALYTICS_API_KEY = "AZURE_TEXT_ANALYTICS_API_KEY"; stati...
class TestUtils { private static final String DEFAULT_MODEL_VERSION = "2019-10-01"; static final String INVALID_URL = "htttttttps: static final String VALID_HTTPS_LOCALHOST = "https: static final String FAKE_API_KEY = "1234567890"; static final String AZURE_TEXT_ANALYTICS_API_KEY = "AZURE_TEXT_ANALYTICS_API_KEY"; stati...
they are two difference bingId.
static List<LinkedEntity> getLinkedEntitiesList1() { final LinkedEntityMatch linkedEntityMatch = new LinkedEntityMatch("Seattle", 0.0, 26, 7); LinkedEntity linkedEntity = new LinkedEntity( "Seattle", new IterableStream<>(Collections.singletonList(linkedEntityMatch)), "en", "Seattle", "https: "Wikipedia", "5fbba6b8-85e1...
"Wikipedia", "5fbba6b8-85e1-4d41-9444-d9055436e473");
static List<LinkedEntity> getLinkedEntitiesList1() { final LinkedEntityMatch linkedEntityMatch = new LinkedEntityMatch("Seattle", 0.0, 26, 7); LinkedEntity linkedEntity = new LinkedEntity( "Seattle", new IterableStream<>(Collections.singletonList(linkedEntityMatch)), "en", "Seattle", "https: "Wikipedia", "5fbba6b8-85e1...
class TestUtils { private static final String DEFAULT_MODEL_VERSION = "2019-10-01"; static final String INVALID_URL = "htttttttps: static final String VALID_HTTPS_LOCALHOST = "https: static final String FAKE_API_KEY = "1234567890"; static final String AZURE_TEXT_ANALYTICS_API_KEY = "AZURE_TEXT_ANALYTICS_API_KEY"; stati...
class TestUtils { private static final String DEFAULT_MODEL_VERSION = "2019-10-01"; static final String INVALID_URL = "htttttttps: static final String VALID_HTTPS_LOCALHOST = "https: static final String FAKE_API_KEY = "1234567890"; static final String AZURE_TEXT_ANALYTICS_API_KEY = "AZURE_TEXT_ANALYTICS_API_KEY"; stati...
what this change for ?
public Flux<ByteBuf> body() { return bodyIntern() .doOnSubscribe(this::updateSubscriptionState); }
.doOnSubscribe(this::updateSubscriptionState);
public Flux<ByteBuf> body() { return bodyIntern() .doOnSubscribe(this::updateSubscriptionState); }
class ReactorNettyHttpResponse extends HttpResponse { private final AtomicReference<ReactorNettyResponseState> state = new AtomicReference<>(ReactorNettyResponseState.NOT_SUBSCRIBED); private final HttpClientResponse reactorNettyResponse; private final Connection reactorNettyConnection; ReactorNettyHttpResponse(HttpCli...
class ReactorNettyHttpResponse extends HttpResponse { private final AtomicReference<ReactorNettyResponseState> state = new AtomicReference<>(ReactorNettyResponseState.NOT_SUBSCRIBED); private final HttpClientResponse reactorNettyResponse; private final Connection reactorNettyConnection; ReactorNettyHttpResponse(HttpCli...
Just removed the unnecessary `map` operator. We don't need to retain the byteBuf here, as it is not released afterwards. This can potentially raise IllegalReferenceCount issue with netty. Although, we don't use this API, which is why no one has seen this issue.
public Flux<ByteBuf> body() { return bodyIntern() .doOnSubscribe(this::updateSubscriptionState); }
.doOnSubscribe(this::updateSubscriptionState);
public Flux<ByteBuf> body() { return bodyIntern() .doOnSubscribe(this::updateSubscriptionState); }
class ReactorNettyHttpResponse extends HttpResponse { private final AtomicReference<ReactorNettyResponseState> state = new AtomicReference<>(ReactorNettyResponseState.NOT_SUBSCRIBED); private final HttpClientResponse reactorNettyResponse; private final Connection reactorNettyConnection; ReactorNettyHttpResponse(HttpCli...
class ReactorNettyHttpResponse extends HttpResponse { private final AtomicReference<ReactorNettyResponseState> state = new AtomicReference<>(ReactorNettyResponseState.NOT_SUBSCRIBED); private final HttpClientResponse reactorNettyResponse; private final Connection reactorNettyConnection; ReactorNettyHttpResponse(HttpCli...
This function is executed when the flux completes with an error
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); final Semaphore deleteTwinsSemaphore = new Semaphore(0); final Semaphore deleteRelationshipsSemaphore = new Semaphore(0); twins .f...
.doOnError(throwable -> {
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); final Semaphore deleteTwinsSemaphore = new Semaphore(0); twins .forEach((twinId, twinContent) -> client.deleteDigitalTwin(twinId) ...
class DigitalTwinsLifecycleSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_ENDPOIN...
class DigitalTwinsLifecycleSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_ENDPOIN...
To understand why do we need semaphore here? Do we have some limitations for parallel operations?
public static void createTwins() throws IOException, InterruptedException { System.out.println("CREATE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); final Semaphore createTwinsSemaphore = new Semaphore(0); twins .forEach((twinId, twinContent) -> client.createDigitalTwinWithRespo...
final Semaphore createTwinsSemaphore = new Semaphore(0);
public static void createTwins() throws IOException, InterruptedException { System.out.println("CREATE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); final Semaphore createTwinsSemaphore = new Semaphore(0); twins .forEach((twinId, twinContent) -> client.createDigitalTwinWithRespo...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
No, not really. The semaphore is to ensure that we do not exit before the async operation has completed. We start all async operations and then release the semaphore only once the async call has completed. That way, the subsequent operations are executed after the previous call has completed -> similar to doing a await...
public static void createTwins() throws IOException, InterruptedException { System.out.println("CREATE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); final Semaphore createTwinsSemaphore = new Semaphore(0); twins .forEach((twinId, twinContent) -> client.createDigitalTwinWithRespo...
final Semaphore createTwinsSemaphore = new Semaphore(0);
public static void createTwins() throws IOException, InterruptedException { System.out.println("CREATE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); final Semaphore createTwinsSemaphore = new Semaphore(0); twins .forEach((twinId, twinContent) -> client.createDigitalTwinWithRespo...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
`.map(Response::getValue)` returns null, which is not a valid return item from a Mono. So we need to map it to `Mono.empty()` instead.
public Mono<Void> deleteModel(String modelId) { return deleteModelWithResponse(modelId) .flatMap(voidResponse -> Mono.empty()); }
.flatMap(voidResponse -> Mono.empty());
public Mono<Void> deleteModel(String modelId) { return deleteModelWithResponse(modelId) .flatMap(voidResponse -> Mono.empty()); }
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}
This implementation is very long and verbose. I am trying to see how I could chain the list and delete operations together, I'll put up an update in the next PR.
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
We should have been able to schedule the async API on a single thread, and forced them to run sequentially; however, I didn't have success with that. I am blocking the async API call for now, until I figure that out.
public static void deleteAllModels() throws InterruptedException { System.out.println("DELETING MODELS"); List<String> models = asList(RoomModelId, WifiModelId, BuildingModelId, FloorModelId, HvacModelId); models .forEach(modelId -> { try { client.deleteModel(modelId).block(); System.out.println("Deleted model: " + mod...
public static void deleteAllModels() throws InterruptedException { System.out.println("DELETING MODELS"); List<String> models = asList(RoomModelId, WifiModelId, BuildingModelId, FloorModelId, HvacModelId); models .forEach(modelId -> { try { client.deleteModel(modelId).block(); System.out.println("Deleted model: " + mod...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
For each async delete? Can you elaborate what you mean here?
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
What is a latch?
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
Does Java support string interpolation?
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
System.out.println("Found and deleted relationship: " + relationship.getId());
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
Appears to be some kind of threadsafe counter, eh? I'd reword this to be "Wait until the latch count reaches zero..."
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
Unfortunate that you have to know ahead of time how many items you are counting down. This presents a "magic" number, which can be confusing to someone else reviewing the code who doesn't realize the significance (this will be used to asynchronously delete 1 dt). Also, in C# we have a general rule of not declaring a v...
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
CountDownLatch deleteTwinsLatch = new CountDownLatch(1);
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
A countdown latch is a mechanism to block the calling thread until other threads that are running in parallel have completed (counted down). The `.countdown()` essentially decrements a thread-safe counter. From this article online: https://www.baeldung.com/java-countdown-latch Simply put, a CountDownLatch has a counte...
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
If Java doesn't have string interpolation, I'd think this would be much more readable as a string format (like below).
public static void deleteAllModels() throws InterruptedException { System.out.println("DELETING MODELS"); List<String> models = asList(RoomModelId, WifiModelId, BuildingModelId, FloorModelId, HvacModelId); models .forEach(modelId -> { try { client.deleteModel(modelId).block(); System.out.println("Deleted model: " + mod...
System.err.println("Could not delete model " + modelId + " due to " + ex);
public static void deleteAllModels() throws InterruptedException { System.out.println("DELETING MODELS"); List<String> models = asList(RoomModelId, WifiModelId, BuildingModelId, FloorModelId, HvacModelId); models .forEach(modelId -> { try { client.deleteModel(modelId).block(); System.out.println("Deleted model: " + mod...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
We can use `String.format()` to specify a template, but nothing as handy as `$` in C#.
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
System.out.println("Found and deleted relationship: " + relationship.getId());
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
We need to initialize these latches and semaphore within the scope that they are referenced in; but yes, I agree, the count can be confusing to understand. I'll add some more comments around this.
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
CountDownLatch deleteTwinsLatch = new CountDownLatch(1);
public static void deleteTwins() throws IOException, InterruptedException { System.out.println("DELETE DIGITAL TWINS"); Map<String, String> twins = FileHelper.loadAllFilesInPath(TwinsPath); for (Map.Entry<String, String> twin : twins.entrySet()) { String twinId = twin.getKey(); List<BasicRelationship> relationshipList ...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
class DigitalTwinsLifecycleAsyncSample { private static final String tenantId = System.getenv("TENANT_ID"); private static final String clientId = System.getenv("CLIENT_ID"); private static final String clientSecret = System.getenv("CLIENT_SECRET"); private static final String endpoint = System.getenv("DIGITAL_TWINS_EN...
Ah, is there no way to set it inline during initialization? Or some annotation perhaps?
public SamplesArguments(String[] args) { Options options = new Options(); Option input = new Option("d", DIGITALTWINS_URL, false, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, false, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, false, "AAD Client Id"); Option clientSecret ...
input.setRequired(true);
public SamplesArguments(String[] args) { Option endpoint = new Option("d", DIGITALTWINS_URL, true, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, true, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, true, "AAD Client Id"); Option clientSecret = new Option("s", CLIENT_SECRET, ...
class SamplesArguments { private final String DIGITALTWINS_URL = "DigitalTwinsEndpoint"; private final String TENANT_ID = "tenantId"; private final String CLIENT_ID = "clientId"; private final String CLIENT_SECRET = "clientSecret"; private String digitalTwinUrl; private String tenantId; private String clientId; private...
class SamplesArguments { private final String DIGITALTWINS_URL = "DigitalTwinsEndpoint"; private final String TENANT_ID = "tenantId"; private final String CLIENT_ID = "clientId"; private final String CLIENT_SECRET = "clientSecret"; private final String LOG_DETAIL_LEVEL = "logLevel"; private String digitalTwinEndpoint; ...
unfortunately not :(
public SamplesArguments(String[] args) { Options options = new Options(); Option input = new Option("d", DIGITALTWINS_URL, false, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, false, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, false, "AAD Client Id"); Option clientSecret ...
input.setRequired(true);
public SamplesArguments(String[] args) { Option endpoint = new Option("d", DIGITALTWINS_URL, true, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, true, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, true, "AAD Client Id"); Option clientSecret = new Option("s", CLIENT_SECRET, ...
class SamplesArguments { private final String DIGITALTWINS_URL = "DigitalTwinsEndpoint"; private final String TENANT_ID = "tenantId"; private final String CLIENT_ID = "clientId"; private final String CLIENT_SECRET = "clientSecret"; private String digitalTwinUrl; private String tenantId; private String clientId; private...
class SamplesArguments { private final String DIGITALTWINS_URL = "DigitalTwinsEndpoint"; private final String TENANT_ID = "tenantId"; private final String CLIENT_ID = "clientId"; private final String CLIENT_SECRET = "clientSecret"; private final String LOG_DETAIL_LEVEL = "logLevel"; private String digitalTwinEndpoint; ...
nit: Can we do an inline addition to `options`? Just trying to reduce the lines of code here!
public SamplesArguments(String[] args) { Options options = new Options(); Option input = new Option("d", DIGITALTWINS_URL, false, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, false, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, false, "AAD Client Id"); Option clientSecret ...
options.addOption(input);
public SamplesArguments(String[] args) { Option endpoint = new Option("d", DIGITALTWINS_URL, true, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, true, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, true, "AAD Client Id"); Option clientSecret = new Option("s", CLIENT_SECRET, ...
class SamplesArguments { private final String DIGITALTWINS_URL = "DigitalTwinsEndpoint"; private final String TENANT_ID = "tenantId"; private final String CLIENT_ID = "clientId"; private final String CLIENT_SECRET = "clientSecret"; private String digitalTwinUrl; private String tenantId; private String clientId; private...
class SamplesArguments { private final String DIGITALTWINS_URL = "DigitalTwinsEndpoint"; private final String TENANT_ID = "tenantId"; private final String CLIENT_ID = "clientId"; private final String CLIENT_SECRET = "clientSecret"; private final String LOG_DETAIL_LEVEL = "logLevel"; private String digitalTwinEndpoint; ...
sure, but won't save that much space :))
public SamplesArguments(String[] args) { Options options = new Options(); Option input = new Option("d", DIGITALTWINS_URL, false, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, false, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, false, "AAD Client Id"); Option clientSecret ...
options.addOption(input);
public SamplesArguments(String[] args) { Option endpoint = new Option("d", DIGITALTWINS_URL, true, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, true, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, true, "AAD Client Id"); Option clientSecret = new Option("s", CLIENT_SECRET, ...
class SamplesArguments { private final String DIGITALTWINS_URL = "DigitalTwinsEndpoint"; private final String TENANT_ID = "tenantId"; private final String CLIENT_ID = "clientId"; private final String CLIENT_SECRET = "clientSecret"; private String digitalTwinUrl; private String tenantId; private String clientId; private...
class SamplesArguments { private final String DIGITALTWINS_URL = "DigitalTwinsEndpoint"; private final String TENANT_ID = "tenantId"; private final String CLIENT_ID = "clientId"; private final String CLIENT_SECRET = "clientSecret"; private final String LOG_DETAIL_LEVEL = "logLevel"; private String digitalTwinEndpoint; ...
``` Options options = new Options() .addOption(input) .addOption(tenantId) .addOption(clientId) .addOption(clientSecret); ```
public SamplesArguments(String[] args) { Options options = new Options(); Option input = new Option("d", DIGITALTWINS_URL, false, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, false, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, false, "AAD Client Id"); Option clientSecret ...
options.addOption(input);
public SamplesArguments(String[] args) { Option endpoint = new Option("d", DIGITALTWINS_URL, true, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, true, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, true, "AAD Client Id"); Option clientSecret = new Option("s", CLIENT_SECRET, ...
class SamplesArguments { private final String DIGITALTWINS_URL = "DigitalTwinsEndpoint"; private final String TENANT_ID = "tenantId"; private final String CLIENT_ID = "clientId"; private final String CLIENT_SECRET = "clientSecret"; private String digitalTwinUrl; private String tenantId; private String clientId; private...
class SamplesArguments { private final String DIGITALTWINS_URL = "DigitalTwinsEndpoint"; private final String TENANT_ID = "tenantId"; private final String CLIENT_ID = "clientId"; private final String CLIENT_SECRET = "clientSecret"; private final String LOG_DETAIL_LEVEL = "logLevel"; private String digitalTwinEndpoint; ...
How about: ```java Options options = new Options() .addOption(new Option("d", DIGITALTWINS_URL, false, "DigitalTwins endpoint URL")) .addOption(new Option("t", TENANT_ID, false, "AAD Tenant Id")) .addOption(new Option("c", CLIENT_ID, false, "AAD Client Id")) .addOption(new Option("s", CLIENT_SECRET, fal...
public SamplesArguments(String[] args) { Options options = new Options(); Option input = new Option("d", DIGITALTWINS_URL, false, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, false, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, false, "AAD Client Id"); Option clientSecret ...
options.addOption(input);
public SamplesArguments(String[] args) { Option endpoint = new Option("d", DIGITALTWINS_URL, true, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, true, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, true, "AAD Client Id"); Option clientSecret = new Option("s", CLIENT_SECRET, ...
class SamplesArguments { private final String DIGITALTWINS_URL = "DigitalTwinsEndpoint"; private final String TENANT_ID = "tenantId"; private final String CLIENT_ID = "clientId"; private final String CLIENT_SECRET = "clientSecret"; private String digitalTwinUrl; private String tenantId; private String clientId; private...
class SamplesArguments { private final String DIGITALTWINS_URL = "DigitalTwinsEndpoint"; private final String TENANT_ID = "tenantId"; private final String CLIENT_ID = "clientId"; private final String CLIENT_SECRET = "clientSecret"; private final String LOG_DETAIL_LEVEL = "logLevel"; private String digitalTwinEndpoint; ...
I am not sure I follow this - aren't the created models returned as a result of this API call - `PagedFlux<ModelData>`?
public void modelLifecycleTest(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsAsyncClient asyncClient = getAsyncClient(httpClient, serviceVersion); List<ModelData> createdModels = new ArrayList<>(); createModelsRunner(asyncClient, (modelsList) -> { StepVerifier.create(asyncClient.create...
public void modelLifecycleTest(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsAsyncClient asyncClient = getAsyncClient(httpClient, serviceVersion); List<ModelData> createdModels = new ArrayList<>(); createModelsRunner(asyncClient, (modelsList) -> { StepVerifier.create(asyncClient.create...
class ModelsAsyncTest extends ModelsTestBase { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override public void getModelThrowsIfModelDo...
class ModelsAsyncTest extends ModelsTestBase { private final ClientLogger logger = new ClientLogger(ModelsAsyncTest.class); @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azu...
Or is it that `ModelData.model` is null?
public void modelLifecycleTest(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsAsyncClient asyncClient = getAsyncClient(httpClient, serviceVersion); List<ModelData> createdModels = new ArrayList<>(); createModelsRunner(asyncClient, (modelsList) -> { StepVerifier.create(asyncClient.create...
public void modelLifecycleTest(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsAsyncClient asyncClient = getAsyncClient(httpClient, serviceVersion); List<ModelData> createdModels = new ArrayList<>(); createModelsRunner(asyncClient, (modelsList) -> { StepVerifier.create(asyncClient.create...
class ModelsAsyncTest extends ModelsTestBase { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override public void getModelThrowsIfModelDo...
class ModelsAsyncTest extends ModelsTestBase { private final ClientLogger logger = new ClientLogger(ModelsAsyncTest.class); @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azu...
I had been using `org.apache.http.HttpStatus` in the sample, but I like `java.net.HttpURLConnection` better; I'll make the switch.
public void getModelThrowsIfModelDoesNotExist(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsAsyncClient asyncClient = getAsyncClient(httpClient, serviceVersion); final String nonExistantModelId = "urn:doesnotexist:fakemodel:1000"; StepVerifier.create(asyncClient.getModel(nonExistantMod...
StepVerifier.create(asyncClient.getModel(nonExistantModelId))
public void getModelThrowsIfModelDoesNotExist(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsAsyncClient asyncClient = getAsyncClient(httpClient, serviceVersion); final String nonExistantModelId = "urn:doesnotexist:fakemodel:1000"; StepVerifier.create(asyncClient.getModel(nonExistantMod...
class ModelsAsyncTest extends ModelsTestBase { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override public void modelLifecycleTest(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsAsyncClient asyncClient = getAsyncClient(ht...
class ModelsAsyncTest extends ModelsTestBase { private final ClientLogger logger = new ClientLogger(ModelsAsyncTest.class); @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override public void modelLifecycleTest(HttpClient httpClient, DigitalTwinsServiceVers...
I see that this is an azure-core helper, so they maintain the list of http clients they test against; nice!
static Stream<Arguments> getTestParameters() { List<Arguments> argumentsList = new ArrayList<>(); getHttpClients() .forEach(httpClient -> { Arrays.stream(DigitalTwinsServiceVersion.values()).filter(TestHelper::shouldServiceVersionBeTested) .forEach(serviceVersion -> argumentsList.add(Arguments.of(httpClient, serviceVer...
List<Arguments> argumentsList = new ArrayList<>();
static Stream<Arguments> getTestParameters() { List<Arguments> argumentsList = new ArrayList<>(); getHttpClients() .forEach(httpClient -> { Arrays.stream(DigitalTwinsServiceVersion.values()).filter(TestHelper::shouldServiceVersionBeTested) .forEach(serviceVersion -> argumentsList.add(Arguments.of(httpClient, serviceVer...
class TestHelper { public static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; private static final String AZURE_DIGITALTWINS_TEST_SERVICE_VERSIONS = "AZURE_DIGITALTWINS_TEST_SERVICE_VERSIONS"; private static final String SERVICE_VERSION_FROM_ENV = Configuration.getGlobalConfiguration()...
class TestHelper { public static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; private static final String AZURE_DIGITALTWINS_TEST_SERVICE_VERSIONS = "AZURE_DIGITALTWINS_TEST_SERVICE_VERSIONS"; private static final String SERVICE_VERSION_FROM_ENV = Configuration.getGlobalConfiguration()...
consider adding a check to verify there is content in the property and then print it
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); String document = "Old Faithful is a geyser at Yellowstone Park."; client.recognizeLinkedEntities(document).forEach(linkedEntity -> ...
+ " Bing Entity Search API ID: %s.%n",
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); String document = "Old Faithful is a geyser at Yellowstone Park."; client.recognizeLinkedEntities(document).forEach(linkedEntity -> ...
class RecognizeLinkedEntities { /** * Main method to invoke this demo about how to recognize the linked entities of document. * * @param args Unused arguments to the program. */ }
class RecognizeLinkedEntities { /** * Main method to invoke this demo about how to recognize the linked entities of document. * * @param args Unused arguments to the program. */ }
ModelData.model is null when the service returns it from a createModel call. I'm reworking this code a bit
public void modelLifecycleTest(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsAsyncClient asyncClient = getAsyncClient(httpClient, serviceVersion); List<ModelData> createdModels = new ArrayList<>(); createModelsRunner(asyncClient, (modelsList) -> { StepVerifier.create(asyncClient.create...
public void modelLifecycleTest(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsAsyncClient asyncClient = getAsyncClient(httpClient, serviceVersion); List<ModelData> createdModels = new ArrayList<>(); createModelsRunner(asyncClient, (modelsList) -> { StepVerifier.create(asyncClient.create...
class ModelsAsyncTest extends ModelsTestBase { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override public void getModelThrowsIfModelDo...
class ModelsAsyncTest extends ModelsTestBase { private final ClientLogger logger = new ClientLogger(ModelsAsyncTest.class); @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azu...
I see ```java.net.HttpURLConnection``` used in the app configuration SDK code, so I'd recommend it
public void getModelThrowsIfModelDoesNotExist(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsAsyncClient asyncClient = getAsyncClient(httpClient, serviceVersion); final String nonExistantModelId = "urn:doesnotexist:fakemodel:1000"; StepVerifier.create(asyncClient.getModel(nonExistantMod...
StepVerifier.create(asyncClient.getModel(nonExistantModelId))
public void getModelThrowsIfModelDoesNotExist(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsAsyncClient asyncClient = getAsyncClient(httpClient, serviceVersion); final String nonExistantModelId = "urn:doesnotexist:fakemodel:1000"; StepVerifier.create(asyncClient.getModel(nonExistantMod...
class ModelsAsyncTest extends ModelsTestBase { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override public void modelLifecycleTest(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsAsyncClient asyncClient = getAsyncClient(ht...
class ModelsAsyncTest extends ModelsTestBase { private final ClientLogger logger = new ClientLogger(ModelsAsyncTest.class); @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override public void modelLifecycleTest(HttpClient httpClient, DigitalTwinsServiceVers...
we might not to do this for-each iteration, create models does not return a pageable anymore, so the blocking call should directly complete with result.
public void createModelThrowsIfModelAlreadyExists(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsClient client = getClient(httpClient, serviceVersion); final List<String> modelsToCreate = new ArrayList<>(); final String wardModelId = UniqueIdHelper.getUniqueModelId(TestAssetDefaults.WAR...
() -> client.createModels(modelsToCreate).forEach((modelData) -> {
public void createModelThrowsIfModelAlreadyExists(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { DigitalTwinsClient client = getClient(httpClient, serviceVersion); final List<String> modelsToCreate = new ArrayList<>(); final String wardModelId = UniqueIdHelper.getUniqueModelId(TestAssetDefaults.WAR...
class ModelsTest extends ModelsTestBase { private final ClientLogger logger = new ClientLogger(ModelsTestBase.class); @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override public void modelLifecycleTest(HttpClient httpClient, DigitalTwinsServiceVersion se...
class ModelsTest extends ModelsTestBase { private final ClientLogger logger = new ClientLogger(ModelsTestBase.class); @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.digitaltwins.core.TestHelper @Override public void modelLifecycleTest(HttpClient httpClient, DigitalTwinsServiceVersion se...
hmm and actually, it might be better not to include it in the samples as this is a super specific property that will only be used by advanced customers... so better if we don't confuse our normal users
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); String document = "Old Faithful is a geyser at Yellowstone Park."; client.recognizeLinkedEntities(document).forEach(linkedEntity -> ...
+ " Bing Entity Search API ID: %s.%n",
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); String document = "Old Faithful is a geyser at Yellowstone Park."; client.recognizeLinkedEntities(document).forEach(linkedEntity -> ...
class RecognizeLinkedEntities { /** * Main method to invoke this demo about how to recognize the linked entities of document. * * @param args Unused arguments to the program. */ }
class RecognizeLinkedEntities { /** * Main method to invoke this demo about how to recognize the linked entities of document. * * @param args Unused arguments to the program. */ }
Can we split this into another test case and disable it? I feel it'll get lost as a comment since there is no issue or TODO tracking this.
void updateEntityWithResponseAsync(UpdateMode mode) { final boolean expectOldProperty = mode == UpdateMode.MERGE; final String partitionKeyValue = testResourceNamer.randomName("APartitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("ARowKey", 20); final int expectedStatusCode = 204; final String o...
StepVerifier.create(tableClient.updateEntityWithResponse(createdEntity, true, mode))
void updateEntityWithResponseAsync(UpdateMode mode) { final boolean expectOldProperty = mode == UpdateMode.MERGE; final String partitionKeyValue = testResourceNamer.randomName("APartitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("ARowKey", 20); final int expectedStatusCode = 204; final String o...
class TablesAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(100); private TableAsyncClient tableClient; private HttpPipelinePolicy recordPolicy; private HttpClient playbackClient; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(TIMEOUT); } @AfterAll stat...
class TablesAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(100); private TableAsyncClient tableClient; private HttpPipelinePolicy recordPolicy; private HttpClient playbackClient; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(TIMEOUT); } @AfterAll stat...
Is there a reason for splitting this into three sequential blocks rather than running them concurrently?
void serviceListTablesWithTopAsync() { final String tableName = testResourceNamer.randomName("test", 20); final String tableName2 = testResourceNamer.randomName("test", 20); final String tableName3 = testResourceNamer.randomName("test", 20); ListTablesOptions options = new ListTablesOptions().setTop(2); serviceClient.c...
serviceClient.createTable(tableName).block(TIMEOUT);
void serviceListTablesWithTopAsync() { final String tableName = testResourceNamer.randomName("test", 20); final String tableName2 = testResourceNamer.randomName("test", 20); final String tableName3 = testResourceNamer.randomName("test", 20); ListTablesOptions options = new ListTablesOptions().setTop(2); serviceClient.c...
class TableServiceAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(100); private TableServiceAsyncClient serviceClient; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(TIMEOUT); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } @O...
class TableServiceAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(100); private TableServiceAsyncClient serviceClient; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(TIMEOUT); } @AfterAll static void afterAll() { StepVerifier.resetDefaultTimeout(); } @O...
Yes, once support is merged for multiple tests with the same name (#14801) I will separate these into two test classes, one for Cosmos and one for Storage, each with their own recordings.
void updateEntityWithResponseAsync(UpdateMode mode) { final boolean expectOldProperty = mode == UpdateMode.MERGE; final String partitionKeyValue = testResourceNamer.randomName("APartitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("ARowKey", 20); final int expectedStatusCode = 204; final String o...
StepVerifier.create(tableClient.updateEntityWithResponse(createdEntity, true, mode))
void updateEntityWithResponseAsync(UpdateMode mode) { final boolean expectOldProperty = mode == UpdateMode.MERGE; final String partitionKeyValue = testResourceNamer.randomName("APartitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("ARowKey", 20); final int expectedStatusCode = 204; final String o...
class TablesAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(100); private TableAsyncClient tableClient; private HttpPipelinePolicy recordPolicy; private HttpClient playbackClient; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(TIMEOUT); } @AfterAll stat...
class TablesAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(100); private TableAsyncClient tableClient; private HttpPipelinePolicy recordPolicy; private HttpClient playbackClient; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(TIMEOUT); } @AfterAll stat...
Tracking this work in #14930
void updateEntityWithResponseAsync(UpdateMode mode) { final boolean expectOldProperty = mode == UpdateMode.MERGE; final String partitionKeyValue = testResourceNamer.randomName("APartitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("ARowKey", 20); final int expectedStatusCode = 204; final String o...
StepVerifier.create(tableClient.updateEntityWithResponse(createdEntity, true, mode))
void updateEntityWithResponseAsync(UpdateMode mode) { final boolean expectOldProperty = mode == UpdateMode.MERGE; final String partitionKeyValue = testResourceNamer.randomName("APartitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("ARowKey", 20); final int expectedStatusCode = 204; final String o...
class TablesAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(100); private TableAsyncClient tableClient; private HttpPipelinePolicy recordPolicy; private HttpClient playbackClient; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(TIMEOUT); } @AfterAll stat...
class TablesAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(100); private TableAsyncClient tableClient; private HttpPipelinePolicy recordPolicy; private HttpClient playbackClient; @BeforeAll static void beforeAll() { StepVerifier.setDefaultTimeout(TIMEOUT); } @AfterAll stat...
If playbackRecordName is null, should this fallback to `testName`?
private InterceptorManager(String testName, String playbackRecordName, TestMode testMode, boolean doNotRecord) { Objects.requireNonNull(testName, "'testName' cannot be null."); this.testName = testName; this.playbackRecordName = playbackRecordName; this.testMode = testMode; this.textReplacementRules = new HashMap<>(); ...
this.playbackRecordName = playbackRecordName;
private InterceptorManager(String testName, String playbackRecordName, TestMode testMode, boolean doNotRecord) { Objects.requireNonNull(testName, "'testName' cannot be null."); this.testName = testName; this.playbackRecordName = CoreUtils.isNullOrEmpty(playbackRecordName) ? testName : playbackRecordName; this.testMode ...
class InterceptorManager implements AutoCloseable { private static final String RECORD_FOLDER = "session-records/"; private static final ObjectMapper RECORD_MAPPER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private final ClientLogger logger = new ClientLogger(InterceptorManager.class); private fin...
class InterceptorManager implements AutoCloseable { private static final String RECORD_FOLDER = "session-records/"; private static final ObjectMapper RECORD_MAPPER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private final ClientLogger logger = new ClientLogger(InterceptorManager.class); private fin...
Yes, everything calling into this should be passing `testName` for `playbackRecordName` though.
private InterceptorManager(String testName, String playbackRecordName, TestMode testMode, boolean doNotRecord) { Objects.requireNonNull(testName, "'testName' cannot be null."); this.testName = testName; this.playbackRecordName = playbackRecordName; this.testMode = testMode; this.textReplacementRules = new HashMap<>(); ...
this.playbackRecordName = playbackRecordName;
private InterceptorManager(String testName, String playbackRecordName, TestMode testMode, boolean doNotRecord) { Objects.requireNonNull(testName, "'testName' cannot be null."); this.testName = testName; this.playbackRecordName = CoreUtils.isNullOrEmpty(playbackRecordName) ? testName : playbackRecordName; this.testMode ...
class InterceptorManager implements AutoCloseable { private static final String RECORD_FOLDER = "session-records/"; private static final ObjectMapper RECORD_MAPPER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private final ClientLogger logger = new ClientLogger(InterceptorManager.class); private fin...
class InterceptorManager implements AutoCloseable { private static final String RECORD_FOLDER = "session-records/"; private static final ObjectMapper RECORD_MAPPER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private final ClientLogger logger = new ClientLogger(InterceptorManager.class); private fin...
why add two commented statement?
private Mono<Void> withRetry(Mono<Void> observable) { return observable .retryWhen( flux -> flux .zipWith( Flux.range(1, 6), (Throwable throwable, Integer integer) -> { if (throwable instanceof ManagementException && ((ManagementException) throwable).getResponse().getStatusCode() == 502 || throwable instanceof JsonPars...
private Mono<Void> withRetry(Mono<Void> observable) { return observable .retryWhen( flux -> flux .zipWith( Flux.range(1, 6), (Throwable throwable, Integer integer) -> { if (throwable instanceof ManagementException && ((ManagementException) throwable).getResponse().getStatusCode() == 502 || throwable instanceof JsonPars...
class InputStreamFlux { private Flux<ByteBuffer> flux; private byte[] bytes; private long size; }
class InputStreamFlux { private Flux<ByteBuffer> flux; private byte[] bytes; private long size; }
Timeout exception from netty/okhttp respectively. But I cannot reproduce it in track2, so just keep them commented.
private Mono<Void> withRetry(Mono<Void> observable) { return observable .retryWhen( flux -> flux .zipWith( Flux.range(1, 6), (Throwable throwable, Integer integer) -> { if (throwable instanceof ManagementException && ((ManagementException) throwable).getResponse().getStatusCode() == 502 || throwable instanceof JsonPars...
private Mono<Void> withRetry(Mono<Void> observable) { return observable .retryWhen( flux -> flux .zipWith( Flux.range(1, 6), (Throwable throwable, Integer integer) -> { if (throwable instanceof ManagementException && ((ManagementException) throwable).getResponse().getStatusCode() == 502 || throwable instanceof JsonPars...
class InputStreamFlux { private Flux<ByteBuffer> flux; private byte[] bytes; private long size; }
class InputStreamFlux { private Flux<ByteBuffer> flux; private byte[] bytes; private long size; }
The body type is always data, you can return the enum rather than creating a new field variable for it for every instance.
public AmqpBodyType getBodyType() { return bodyType; }
return bodyType;
public AmqpBodyType getBodyType() { return AmqpBodyType.DATA; }
class AmqpDataBody implements AmqpMessageBody { private final AmqpBodyType bodyType; private final IterableStream<BinaryData> data; /** * @param data to be set. */ public AmqpDataBody(Iterable<BinaryData> data) { Objects.requireNonNull(data, "'data' cannot be null."); this.data = new IterableStream<>(data); this.bodyTy...
class AmqpDataBody implements AmqpMessageBody { private final IterableStream<BinaryData> data; /** * Creates instance of {@link AmqpDataBody} with given {@link Iterable} of {@link BinaryData}. * * @param data to be set on amqp body. * * @throws NullPointerException if {@code data} is null. */ public AmqpDataBody(Iterab...
The arrangement should be the first set of `new` operators. And act would be the creation of the message.
public void constructorValidValues() { AmqpAnnotatedMessage actual = new AmqpAnnotatedMessage(new AmqpDataBody(Collections.singletonList(new BinaryData(CONTENTS_BYTES)))); Assertions.assertEquals(AmqpBodyType.DATA, actual.getBody().getBodyType()); Assertions.assertNotNull(actual.getProperties()); Assertions.assertNotNu...
AmqpAnnotatedMessage actual = new AmqpAnnotatedMessage(new AmqpDataBody(Collections.singletonList(new BinaryData(CONTENTS_BYTES))));
public void constructorValidValues() { final List<BinaryData> expectedBinaryData = Collections.singletonList(DATA_BYTES); final AmqpDataBody amqpDataBody = new AmqpDataBody(expectedBinaryData); final AmqpAnnotatedMessage actual = new AmqpAnnotatedMessage(amqpDataBody); assertMessageCreation(AmqpBodyType.DATA, expectedB...
class AmqpAnnotatedMessageTest { private static final byte[] CONTENTS_BYTES = "Some-contents".getBytes(StandardCharsets.UTF_8); /** * Verifies we correctly set values via constructor for {@link AmqpAnnotatedMessage}. */ @Test /** * Verifies {@link AmqpAnnotatedMessage} constructor for null valeus. */ @Test public void ...
class AmqpAnnotatedMessageTest { private static final byte[] CONTENTS_BYTES = "Some-contents".getBytes(StandardCharsets.UTF_8); private static final BinaryData DATA_BYTES = new BinaryData(CONTENTS_BYTES); private final ClientLogger logger = new ClientLogger(AmqpAnnotatedMessageTest.class); /** * Verifies we correctly s...
in general, I'd be consistent about when you're using "final" or not. This applies to all other areas of your code.
public void constructorAmqpValidValues() { final List<BinaryData> listBinaryData = Collections.singletonList(DATA_BYTES); final AmqpDataBody amqpDataBody = new AmqpDataBody(listBinaryData); AmqpAnnotatedMessage expected = new AmqpAnnotatedMessage(amqpDataBody); AmqpAnnotatedMessage actual = new AmqpAnnotatedMessage(exp...
AmqpAnnotatedMessage expected = new AmqpAnnotatedMessage(amqpDataBody);
public void constructorAmqpValidValues() { final List<BinaryData> expectedBinaryData = Collections.singletonList(DATA_BYTES); final AmqpDataBody amqpDataBody = new AmqpDataBody(expectedBinaryData); final AmqpAnnotatedMessage expected = new AmqpAnnotatedMessage(amqpDataBody); final AmqpAnnotatedMessage actual = new Amqp...
class AmqpAnnotatedMessageTest { private static final byte[] CONTENTS_BYTES = "Some-contents".getBytes(StandardCharsets.UTF_8); private static final BinaryData DATA_BYTES = new BinaryData(CONTENTS_BYTES); /** * Verifies we correctly set values via constructor for {@link AmqpAnnotatedMessage}. */ @Test public void const...
class AmqpAnnotatedMessageTest { private static final byte[] CONTENTS_BYTES = "Some-contents".getBytes(StandardCharsets.UTF_8); private static final BinaryData DATA_BYTES = new BinaryData(CONTENTS_BYTES); private final ClientLogger logger = new ClientLogger(AmqpAnnotatedMessageTest.class); /** * Verifies we correctly s...
It's always a single item collection. Why not add another one even though our current implementation layer does not support it.
public void constructorValidValues() { final List<BinaryData> binaryDataList = Collections.singletonList(DATA_BYTES); AmqpDataBody actual = new AmqpDataBody(binaryDataList); assertEquals(AmqpBodyType.DATA, actual.getBodyType()); List<BinaryData> dataList = actual.getData().stream().collect(Collectors.toList()); assertE...
final List<BinaryData> binaryDataList = Collections.singletonList(DATA_BYTES);
public void constructorValidValues() { final List<BinaryData> expectedDataList = new ArrayList<>(); expectedDataList.add(new BinaryData("some data 1".getBytes())); expectedDataList.add(new BinaryData("some data 2".getBytes())); final AmqpDataBody actual = new AmqpDataBody(expectedDataList); assertEquals(AmqpBodyType.DA...
class AmqpDataBodyTest { private static final byte[] CONTENTS_BYTES = "Some-contents".getBytes(StandardCharsets.UTF_8); private static final BinaryData DATA_BYTES = new BinaryData(CONTENTS_BYTES); /** * Verifies we correctly set values via constructor for {@link AmqpAnnotatedMessage}. */ @Test /** * Verifies {@link Bin...
class AmqpDataBodyTest { /** * Verifies we correctly set values via constructor for {@link AmqpAnnotatedMessage}. */ @Test /** * Verifies {@link BinaryData} constructor for null values. */ @Test public void constructorNullValidValues() { final List<BinaryData> listBinaryData = null; Assertions.assertThrows(NullPointerE...
This is common, you can create a private method to aggregate these copied lines.
public String getDeadLetterReason() { final Map<String, Object> properties = amqpAnnotatedMessage.getApplicationProperties(); if (properties.containsKey(DEAD_LETTER_REASON)) { return String.valueOf(properties.get(DEAD_LETTER_REASON)); } return null; }
final Map<String, Object> properties = amqpAnnotatedMessage.getApplicationProperties();
public String getDeadLetterReason() { return getStringValue(amqpAnnotatedMessage.getApplicationProperties(), DEAD_LETTER_REASON_ANNOTATION_NAME.getValue()); }
class ServiceBusReceivedMessage { private final ClientLogger logger = new ClientLogger(ServiceBusReceivedMessage.class); private static final String DEAD_LETTER_DESCRIPTION = "DeadLetterErrorDescription"; private static final String DEAD_LETTER_REASON = "DeadLetterReason"; private static final String ENQUEUED_SEQUENCE_...
class ServiceBusReceivedMessage { private final ClientLogger logger = new ClientLogger(ServiceBusReceivedMessage.class); private final AmqpAnnotatedMessage amqpAnnotatedMessage; private final byte[] binaryData; private UUID lockToken; /** * The representation of message as defined by AMQP protocol. * * @see <a href="ht...
The point I was trying to make is that you know this data in the constructor. You can do this logic in the constructor and simply return a copy of the binary data. Before, you were iterating through the Iterable of BinaryData each time, creating a new List object and then throwing it away to get the first item before ...
public byte[] getBody() { byte[] body = null; final AmqpBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType(); switch (bodyType) { case DATA: final BinaryData binaryData = ((AmqpDataBody) amqpAnnotatedMessage.getBody()).getBinaryData(); if (binaryData != null) { body = binaryData.getData(); } break; case SEQ...
byte[] body = null;
public byte[] getBody() { final AmqpBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType(); switch (bodyType) { case DATA: return Arrays.copyOf(binaryData, binaryData.length); case SEQUENCE: case VALUE: throw logger.logExceptionAsError(new UnsupportedOperationException("Body type not supported yet " + bodyTyp...
class ServiceBusReceivedMessage { private final ClientLogger logger = new ClientLogger(ServiceBusReceivedMessage.class); private static final String DEAD_LETTER_DESCRIPTION = "DeadLetterErrorDescription"; private static final String DEAD_LETTER_REASON = "DeadLetterReason"; private static final String ENQUEUED_SEQUENCE_...
class ServiceBusReceivedMessage { private final ClientLogger logger = new ClientLogger(ServiceBusReceivedMessage.class); private final AmqpAnnotatedMessage amqpAnnotatedMessage; private final byte[] binaryData; private UUID lockToken; /** * The representation of message as defined by AMQP protocol. * * @see <a href="ht...
The extra message is not necessary. If this fails, we'll know the line that it failed at.
void receiveAndValidateProperties(MessagingEntityType entityType) { final boolean isSessionEnabled = false; final String subject = "subject"; final Map<String, Object> footer = new HashMap<>(); footer.put("footer-key-1", "footer-value-1"); footer.put("footer-key-2", "footer-value-2"); final Map<String, Object> aplicait...
assertEquals(expectedAmqpProperties.getHeader().getPriority(), actual.getHeader().getPriority(), "Header.priority is not equal.");
void receiveAndValidateProperties(MessagingEntityType entityType) { final boolean isSessionEnabled = false; final String subject = "subject"; final Map<String, Object> footer = new HashMap<>(); footer.put("footer-key-1", "footer-value-1"); footer.put("footer-key-2", "footer-value-2"); final Map<String, Object> aplicait...
class ServiceBusReceiverAsyncClientIntegrationTest extends IntegrationTestBase { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverAsyncClientIntegrationTest.class); private final AtomicInteger messagesPending = new AtomicInteger(); private final List<Long> messagesDeferredPending = new ArrayList<>...
class ServiceBusReceiverAsyncClientIntegrationTest extends IntegrationTestBase { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverAsyncClientIntegrationTest.class); private final AtomicInteger messagesPending = new AtomicInteger(); private final List<Long> messagesDeferredPending = new ArrayList<>...
```suggestion var value = amqpAnnotatedMessage.getMessageAnnotations().get(SCHEDULED_ENQUEUE_UTC_TIME_NAME.getValue()); return value != null ? ((Date) value).toInstant().atOffset(ZoneOffset.UTC) : null; ```
public OffsetDateTime getScheduledEnqueueTime() { OffsetDateTime scheduledEnqueueTime = null; Map<String, Object> messageAnnotationMap = amqpAnnotatedMessage.getMessageAnnotations(); if (messageAnnotationMap.containsKey(SCHEDULED_ENQUEUE_UTC_TIME_NAME.getValue())) { scheduledEnqueueTime = ((Date) messageAnnotationMap.g...
Map<String, Object> messageAnnotationMap = amqpAnnotatedMessage.getMessageAnnotations();
public OffsetDateTime getScheduledEnqueueTime() { Object value = amqpAnnotatedMessage.getMessageAnnotations().get(SCHEDULED_ENQUEUE_UTC_TIME_NAME.getValue()); return value != null ? ((Date) value).toInstant().atOffset(ZoneOffset.UTC) : null; }
class ServiceBusMessage { private final AmqpAnnotatedMessage amqpAnnotatedMessage; private final ClientLogger logger = new ClientLogger(ServiceBusMessage.class); private final byte[] binaryData; private Context context; /** * Creates a {@link ServiceBusMessage} with a {@link java.nio.charset.StandardCharsets * * @param...
class ServiceBusMessage { private final AmqpAnnotatedMessage amqpAnnotatedMessage; private final ClientLogger logger = new ClientLogger(ServiceBusMessage.class); private final byte[] binaryData; private Context context; /** * Creates a {@link ServiceBusMessage} with a {@link java.nio.charset.StandardCharsets * * @param...
The local variable declaration is unnecessary.
public OffsetDateTime getScheduledEnqueueTime() { OffsetDateTime scheduledEnqueueTime = null; Map<String, Object> messageAnnotationMap = amqpAnnotatedMessage.getMessageAnnotations(); if (messageAnnotationMap.containsKey(SCHEDULED_ENQUEUE_UTC_TIME_NAME.getValue())) { scheduledEnqueueTime = ((Date) messageAnnotationMap.g...
Map<String, Object> messageAnnotationMap = amqpAnnotatedMessage.getMessageAnnotations();
public OffsetDateTime getScheduledEnqueueTime() { Object value = amqpAnnotatedMessage.getMessageAnnotations().get(SCHEDULED_ENQUEUE_UTC_TIME_NAME.getValue()); return value != null ? ((Date) value).toInstant().atOffset(ZoneOffset.UTC) : null; }
class ServiceBusMessage { private final AmqpAnnotatedMessage amqpAnnotatedMessage; private final ClientLogger logger = new ClientLogger(ServiceBusMessage.class); private final byte[] binaryData; private Context context; /** * Creates a {@link ServiceBusMessage} with a {@link java.nio.charset.StandardCharsets * * @param...
class ServiceBusMessage { private final AmqpAnnotatedMessage amqpAnnotatedMessage; private final ClientLogger logger = new ClientLogger(ServiceBusMessage.class); private final byte[] binaryData; private Context context; /** * Creates a {@link ServiceBusMessage} with a {@link java.nio.charset.StandardCharsets * * @param...
What if they're trying to clear the scheduledEnqueueTime? Isn't null a value option to pass? Same with other instances.
public ServiceBusMessage setScheduledEnqueueTime(OffsetDateTime scheduledEnqueueTime) { if (scheduledEnqueueTime != null) { amqpAnnotatedMessage.getMessageAnnotations().put(SCHEDULED_ENQUEUE_UTC_TIME_NAME.getValue(), scheduledEnqueueTime); } return this; }
if (scheduledEnqueueTime != null) {
public ServiceBusMessage setScheduledEnqueueTime(OffsetDateTime scheduledEnqueueTime) { if (scheduledEnqueueTime != null) { amqpAnnotatedMessage.getMessageAnnotations().put(SCHEDULED_ENQUEUE_UTC_TIME_NAME.getValue(), scheduledEnqueueTime); } return this; }
class ServiceBusMessage { private final AmqpAnnotatedMessage amqpAnnotatedMessage; private final ClientLogger logger = new ClientLogger(ServiceBusMessage.class); private final byte[] binaryData; private Context context; /** * Creates a {@link ServiceBusMessage} with a {@link java.nio.charset.StandardCharsets * * @param...
class ServiceBusMessage { private final AmqpAnnotatedMessage amqpAnnotatedMessage; private final ClientLogger logger = new ClientLogger(ServiceBusMessage.class); private final byte[] binaryData; private Context context; /** * Creates a {@link ServiceBusMessage} with a {@link java.nio.charset.StandardCharsets * * @param...
Internally these key,value pair is stored in Map and Null value is not allowed. The code on master is also checking for `null` and not putting in map is user provided null value. User can get `Map` using `amqpAnnotatedMessage.getMessageAnnotations()` and remove a key if they do not want it.
public ServiceBusMessage setScheduledEnqueueTime(OffsetDateTime scheduledEnqueueTime) { if (scheduledEnqueueTime != null) { amqpAnnotatedMessage.getMessageAnnotations().put(SCHEDULED_ENQUEUE_UTC_TIME_NAME.getValue(), scheduledEnqueueTime); } return this; }
if (scheduledEnqueueTime != null) {
public ServiceBusMessage setScheduledEnqueueTime(OffsetDateTime scheduledEnqueueTime) { if (scheduledEnqueueTime != null) { amqpAnnotatedMessage.getMessageAnnotations().put(SCHEDULED_ENQUEUE_UTC_TIME_NAME.getValue(), scheduledEnqueueTime); } return this; }
class ServiceBusMessage { private final AmqpAnnotatedMessage amqpAnnotatedMessage; private final ClientLogger logger = new ClientLogger(ServiceBusMessage.class); private final byte[] binaryData; private Context context; /** * Creates a {@link ServiceBusMessage} with a {@link java.nio.charset.StandardCharsets * * @param...
class ServiceBusMessage { private final AmqpAnnotatedMessage amqpAnnotatedMessage; private final ClientLogger logger = new ClientLogger(ServiceBusMessage.class); private final byte[] binaryData; private Context context; /** * Creates a {@link ServiceBusMessage} with a {@link java.nio.charset.StandardCharsets * * @param...
May be worthwhile to document here. it's odd having one method do one thing and then the other do something else.
public ServiceBusMessage setScheduledEnqueueTime(OffsetDateTime scheduledEnqueueTime) { if (scheduledEnqueueTime != null) { amqpAnnotatedMessage.getMessageAnnotations().put(SCHEDULED_ENQUEUE_UTC_TIME_NAME.getValue(), scheduledEnqueueTime); } return this; }
if (scheduledEnqueueTime != null) {
public ServiceBusMessage setScheduledEnqueueTime(OffsetDateTime scheduledEnqueueTime) { if (scheduledEnqueueTime != null) { amqpAnnotatedMessage.getMessageAnnotations().put(SCHEDULED_ENQUEUE_UTC_TIME_NAME.getValue(), scheduledEnqueueTime); } return this; }
class ServiceBusMessage { private final AmqpAnnotatedMessage amqpAnnotatedMessage; private final ClientLogger logger = new ClientLogger(ServiceBusMessage.class); private final byte[] binaryData; private Context context; /** * Creates a {@link ServiceBusMessage} with a {@link java.nio.charset.StandardCharsets * * @param...
class ServiceBusMessage { private final AmqpAnnotatedMessage amqpAnnotatedMessage; private final ClientLogger logger = new ClientLogger(ServiceBusMessage.class); private final byte[] binaryData; private Context context; /** * Creates a {@link ServiceBusMessage} with a {@link java.nio.charset.StandardCharsets * * @param...
yeah, this file no longer exists so updated the sample.
public static void main(final String[] args) { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildAsyncClient(); PollerFlux<FormRecognizerOperationResult, List<FormPage>> recognizeContentPoller = client.beginRecognizeContentFromUrl(...
client.beginRecognizeContentFromUrl("https:
public static void main(final String[] args) { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildAsyncClient(); PollerFlux<FormRecognizerOperationResult, List<FormPage>> recognizeContentPoller = client.beginRecognizeContentFromUrl(...
class RecognizeContentFromUrlAsync { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
class RecognizeContentFromUrlAsync { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
``` return digitalTwinsAsyncClient.createModelsWithResponse(models, Context.NONE) .map(Response::getValue).block(); ```
public List<ModelData> createModels(List<String> models) { return digitalTwinsAsyncClient.createModels(models).block(); }
return digitalTwinsAsyncClient.createModels(models).block();
public List<ModelData> createModels(List<String> models) { return createModelsWithResponse(models, Context.NONE).getValue(); }
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link PagedIterable}
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link PagedIterable}
nit: we've been following the pattern where each sync API calls its max arg overload, and the max arg overload calls into the async API; so this could call `createModelsWithResponse(List<String> models, Context context)` sync API with `Context.None`.
public List<ModelData> createModels(List<String> models) { return digitalTwinsAsyncClient.createModels(models).block(); }
return digitalTwinsAsyncClient.createModels(models).block();
public List<ModelData> createModels(List<String> models) { return createModelsWithResponse(models, Context.NONE).getValue(); }
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link PagedIterable}
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link PagedIterable}
👍
public static void createAllModels() throws IOException, InterruptedException { System.out.println("CREATING MODELS"); List<String> modelsToCreate = new ArrayList<>(FileHelper.loadAllFilesInPath(ModelsPath).values()); final CountDownLatch createModelsLatch = new CountDownLatch(1); client.createModels(modelsToCreate) .d...
.doOnNext(listOfModelData -> System.out.println("Count of created models: " + listOfModelData.size()))
public static void createAllModels() throws IOException, InterruptedException { System.out.println("CREATING MODELS"); List<String> modelsToCreate = new ArrayList<>(FileHelper.loadAllFilesInPath(ModelsPath).values()); final CountDownLatch createModelsLatch = new CountDownLatch(1); client.createModels(modelsToCreate) .d...
class DigitalTwinsLifecycleAsyncSample { private static final int MaxWaitTimeAsyncOperationsInSeconds = 10; private static final ObjectMapper mapper = new ObjectMapper(); private static final URL DtdlDirectoryUrl = DigitalTwinsLifecycleAsyncSample.class.getClassLoader().getResource("DTDL"); private static final Path Dt...
class DigitalTwinsLifecycleAsyncSample { private static final int MaxWaitTimeAsyncOperationsInSeconds = 10; private static final ObjectMapper mapper = new ObjectMapper(); private static final URL DtdlDirectoryUrl = DigitalTwinsLifecycleAsyncSample.class.getClassLoader().getResource("DTDL"); private static final Path Dt...
?
public List<ModelData> createModels(List<String> models) { return digitalTwinsAsyncClient.createModels(models).block(); }
return digitalTwinsAsyncClient.createModels(models).block();
public List<ModelData> createModels(List<String> models) { return createModelsWithResponse(models, Context.NONE).getValue(); }
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link PagedIterable}
class to convert the relationship to. * @param <T> The generic type to convert the relationship to. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link PagedIterable}
Are we checking in with this TODO? 😮
public static void runModelLifecycleSample() { String componentModelId = UniqueIdHelper.getUniqueModelId(SamplesConstants.TemporaryComponentModelPrefix, client); String sampleModelId = UniqueIdHelper.getUniqueModelId(SamplesConstants.TemporaryModelPrefix, client); String newComponentModelPayload = SamplesConstants.Temp...
public static void runModelLifecycleSample() { String componentModelId = UniqueIdHelper.getUniqueModelId(SamplesConstants.TemporaryComponentModelPrefix, client); String sampleModelId = UniqueIdHelper.getUniqueModelId(SamplesConstants.TemporaryModelPrefix, client); String newComponentModelPayload = SamplesConstants.Temp...
class ModelsLifecycleSyncSamples { private static DigitalTwinsClient client; public static void main(String[] args) throws IOException, InterruptedException { SamplesArguments parsedArguments = new SamplesArguments(args); client = new DigitalTwinsClientBuilder() .tokenCredential( new ClientSecretCredentialBuilder() .te...
class ModelsLifecycleSyncSamples { private static DigitalTwinsClient client; public static void main(String[] args) throws IOException, InterruptedException { SamplesArguments parsedArguments = new SamplesArguments(args); client = new DigitalTwinsClientBuilder() .tokenCredential( new ClientSecretCredentialBuilder() .te...
:D removed.
public static void runModelLifecycleSample() { String componentModelId = UniqueIdHelper.getUniqueModelId(SamplesConstants.TemporaryComponentModelPrefix, client); String sampleModelId = UniqueIdHelper.getUniqueModelId(SamplesConstants.TemporaryModelPrefix, client); String newComponentModelPayload = SamplesConstants.Temp...
public static void runModelLifecycleSample() { String componentModelId = UniqueIdHelper.getUniqueModelId(SamplesConstants.TemporaryComponentModelPrefix, client); String sampleModelId = UniqueIdHelper.getUniqueModelId(SamplesConstants.TemporaryModelPrefix, client); String newComponentModelPayload = SamplesConstants.Temp...
class ModelsLifecycleSyncSamples { private static DigitalTwinsClient client; public static void main(String[] args) throws IOException, InterruptedException { SamplesArguments parsedArguments = new SamplesArguments(args); client = new DigitalTwinsClientBuilder() .tokenCredential( new ClientSecretCredentialBuilder() .te...
class ModelsLifecycleSyncSamples { private static DigitalTwinsClient client; public static void main(String[] args) throws IOException, InterruptedException { SamplesArguments parsedArguments = new SamplesArguments(args); client = new DigitalTwinsClientBuilder() .tokenCredential( new ClientSecretCredentialBuilder() .te...
I am updating the sample to use status code from here: https://docs.oracle.com/javase/7/docs/api/java/net/HttpURLConnection.html This is what Tim used in the e2e tests, and what other sdks are using as well.
public static void runModelLifecycleSample() { String componentModelId = UniqueIdHelper.getUniqueModelId(SamplesConstants.TemporaryComponentModelPrefix, client); String sampleModelId = UniqueIdHelper.getUniqueModelId(SamplesConstants.TemporaryModelPrefix, client); String newComponentModelPayload = SamplesConstants.Temp...
if (ex.getResponse().getStatusCode() == HttpStatus.SC_CONFLICT) {
public static void runModelLifecycleSample() { String componentModelId = UniqueIdHelper.getUniqueModelId(SamplesConstants.TemporaryComponentModelPrefix, client); String sampleModelId = UniqueIdHelper.getUniqueModelId(SamplesConstants.TemporaryModelPrefix, client); String newComponentModelPayload = SamplesConstants.Temp...
class ModelsLifecycleSyncSamples { private static DigitalTwinsClient client; public static void main(String[] args) throws IOException, InterruptedException { SamplesArguments parsedArguments = new SamplesArguments(args); client = new DigitalTwinsClientBuilder() .tokenCredential( new ClientSecretCredentialBuilder() .te...
class ModelsLifecycleSyncSamples { private static DigitalTwinsClient client; public static void main(String[] args) throws IOException, InterruptedException { SamplesArguments parsedArguments = new SamplesArguments(args); client = new DigitalTwinsClientBuilder() .tokenCredential( new ClientSecretCredentialBuilder() .te...
@chenghaoharvey Thanks for your great effort. I just have one concern that need the `ErrorMessageStrategy` be hard coded?
protected ErrorMessageStrategy getErrorMessageStrategy() { return DEFAULT_ERROR_MESSAGE_STRATEGY; }
return DEFAULT_ERROR_MESSAGE_STRATEGY;
protected ErrorMessageStrategy getErrorMessageStrategy() { return DEFAULT_ERROR_MESSAGE_STRATEGY; }
class ServiceBusMessageChannelBinder<T extends ServiceBusExtendedBindingProperties> extends AbstractMessageChannelBinder<ExtendedConsumerProperties<ServiceBusConsumerProperties>, ExtendedProducerProperties<ServiceBusProducerProperties>, ServiceBusChannelProvisioner> implements ExtendedPropertiesBinder<MessageChannel, S...
class ServiceBusMessageChannelBinder<T extends ServiceBusExtendedBindingProperties> extends AbstractMessageChannelBinder<ExtendedConsumerProperties<ServiceBusConsumerProperties>, ExtendedProducerProperties<ServiceBusProducerProperties>, ServiceBusChannelProvisioner> implements ExtendedPropertiesBinder<MessageChannel, S...
i just refer to rabbit mq implementation. you mean that message strategy should not be hard coded and user can config it by themselves? Or i just `return new ErrorMessageStrategy()` directly?
protected ErrorMessageStrategy getErrorMessageStrategy() { return DEFAULT_ERROR_MESSAGE_STRATEGY; }
return DEFAULT_ERROR_MESSAGE_STRATEGY;
protected ErrorMessageStrategy getErrorMessageStrategy() { return DEFAULT_ERROR_MESSAGE_STRATEGY; }
class ServiceBusMessageChannelBinder<T extends ServiceBusExtendedBindingProperties> extends AbstractMessageChannelBinder<ExtendedConsumerProperties<ServiceBusConsumerProperties>, ExtendedProducerProperties<ServiceBusProducerProperties>, ServiceBusChannelProvisioner> implements ExtendedPropertiesBinder<MessageChannel, S...
class ServiceBusMessageChannelBinder<T extends ServiceBusExtendedBindingProperties> extends AbstractMessageChannelBinder<ExtendedConsumerProperties<ServiceBusConsumerProperties>, ExtendedProducerProperties<ServiceBusProducerProperties>, ServiceBusChannelProvisioner> implements ExtendedPropertiesBinder<MessageChannel, S...
@yiliuTo may i have your input? I referred to Rabbit MQ binder and they are hard code as well.
protected ErrorMessageStrategy getErrorMessageStrategy() { return DEFAULT_ERROR_MESSAGE_STRATEGY; }
return DEFAULT_ERROR_MESSAGE_STRATEGY;
protected ErrorMessageStrategy getErrorMessageStrategy() { return DEFAULT_ERROR_MESSAGE_STRATEGY; }
class ServiceBusMessageChannelBinder<T extends ServiceBusExtendedBindingProperties> extends AbstractMessageChannelBinder<ExtendedConsumerProperties<ServiceBusConsumerProperties>, ExtendedProducerProperties<ServiceBusProducerProperties>, ServiceBusChannelProvisioner> implements ExtendedPropertiesBinder<MessageChannel, S...
class ServiceBusMessageChannelBinder<T extends ServiceBusExtendedBindingProperties> extends AbstractMessageChannelBinder<ExtendedConsumerProperties<ServiceBusConsumerProperties>, ExtendedProducerProperties<ServiceBusProducerProperties>, ServiceBusChannelProvisioner> implements ExtendedPropertiesBinder<MessageChannel, S...
hihi,any response?
protected ErrorMessageStrategy getErrorMessageStrategy() { return DEFAULT_ERROR_MESSAGE_STRATEGY; }
return DEFAULT_ERROR_MESSAGE_STRATEGY;
protected ErrorMessageStrategy getErrorMessageStrategy() { return DEFAULT_ERROR_MESSAGE_STRATEGY; }
class ServiceBusMessageChannelBinder<T extends ServiceBusExtendedBindingProperties> extends AbstractMessageChannelBinder<ExtendedConsumerProperties<ServiceBusConsumerProperties>, ExtendedProducerProperties<ServiceBusProducerProperties>, ServiceBusChannelProvisioner> implements ExtendedPropertiesBinder<MessageChannel, S...
class ServiceBusMessageChannelBinder<T extends ServiceBusExtendedBindingProperties> extends AbstractMessageChannelBinder<ExtendedConsumerProperties<ServiceBusConsumerProperties>, ExtendedProducerProperties<ServiceBusProducerProperties>, ServiceBusChannelProvisioner> implements ExtendedPropertiesBinder<MessageChannel, S...
I am so sorry that I have ignored this notification for so many days==. After investigating code of `ErrorMessageStrategy` from both Rabbit MQ binder and azure0-spring-integration-core project, I think it makes sense to leave it as hard coded.
protected ErrorMessageStrategy getErrorMessageStrategy() { return DEFAULT_ERROR_MESSAGE_STRATEGY; }
return DEFAULT_ERROR_MESSAGE_STRATEGY;
protected ErrorMessageStrategy getErrorMessageStrategy() { return DEFAULT_ERROR_MESSAGE_STRATEGY; }
class ServiceBusMessageChannelBinder<T extends ServiceBusExtendedBindingProperties> extends AbstractMessageChannelBinder<ExtendedConsumerProperties<ServiceBusConsumerProperties>, ExtendedProducerProperties<ServiceBusProducerProperties>, ServiceBusChannelProvisioner> implements ExtendedPropertiesBinder<MessageChannel, S...
class ServiceBusMessageChannelBinder<T extends ServiceBusExtendedBindingProperties> extends AbstractMessageChannelBinder<ExtendedConsumerProperties<ServiceBusConsumerProperties>, ExtendedProducerProperties<ServiceBusProducerProperties>, ServiceBusChannelProvisioner> implements ExtendedPropertiesBinder<MessageChannel, S...
Why this property remains?
private void normalizeProperties() { this.hostNameBindingsToDelete = new ArrayList<>(); this.appSettingsToAdd = new HashMap<>(); this.appSettingsToRemove = new ArrayList<>(); this.appSettingStickiness = new HashMap<>(); this.connectionStringsToAdd = new HashMap<>(); this.connectionStringsToRemove = new ArrayList<>(); t...
this.hostNameSslStateMap = new HashMap<>(this.webSiteBase.hostnameSslStates());
private void normalizeProperties() { this.hostNameBindingsToCreate = new TreeMap<>(); this.hostNameBindingsToDelete = new ArrayList<>(); this.appSettingsToAdd = new HashMap<>(); this.appSettingsToRemove = new ArrayList<>(); this.appSettingStickiness = new HashMap<>(); this.connectionStringsToAdd = new HashMap<>(); this...
class WebAppBaseImpl<FluentT extends WebAppBase, FluentImplT extends WebAppBaseImpl<FluentT, FluentImplT>> extends GroupableResourceImpl<FluentT, SiteInner, FluentImplT, AppServiceManager> implements WebAppBase, WebAppBase.Definition<FluentT>, WebAppBase.Update<FluentT>, WebAppBase.UpdateStages.WithWebContainer<FluentT...
class WebAppBaseImpl<FluentT extends WebAppBase, FluentImplT extends WebAppBaseImpl<FluentT, FluentImplT>> extends GroupableResourceImpl<FluentT, SiteInner, FluentImplT, AppServiceManager> implements WebAppBase, WebAppBase.Definition<FluentT>, WebAppBase.Update<FluentT>, WebAppBase.UpdateStages.WithWebContainer<FluentT...
Flux.fromIterable().flatMapDelayError()
public Flux<String> deleteByIdsAsync(Collection<String> ids) { if (ids == null || ids.isEmpty()) { return Flux.empty(); } Collection<Mono<String>> observables = new ArrayList<>(); for (String id : ids) { final String resourceGroupName = ResourceUtils.groupFromResourceId(id); final String name = ResourceUtils.nameFromRe...
return Flux.mergeDelayError(32, observables.toArray(new Mono[0]));
public Flux<String> deleteByIdsAsync(Collection<String> ids) { return BatchDeletionImpl.deleteByIdsAsync(ids, this::deleteInnerAsync); }
class WebAppsImpl extends GroupableResourcesImpl<WebApp, WebAppImpl, SiteInner, WebAppsClient, AppServiceManager> implements WebApps, SupportsBatchDeletion { public WebAppsImpl(final AppServiceManager manager) { super(manager.inner().getWebApps(), manager); } @Override public Mono<WebApp> getByResourceGroupAsync(final ...
class WebAppsImpl extends GroupableResourcesImpl<WebApp, WebAppImpl, SiteInner, WebAppsClient, AppServiceManager> implements WebApps, SupportsBatchDeletion { public WebAppsImpl(final AppServiceManager manager) { super(manager.inner().getWebApps(), manager); } @Override public Mono<WebApp> getByResourceGroupAsync(final ...
Updated.
private OffsetDateTime getExpirationTime(String sharedAccessSignature) { String[] parts = sharedAccessSignature.split("&"); return Arrays.stream(parts) .map(part -> part.split("=")) .filter(pair -> pair.length == 2 && pair[0].equalsIgnoreCase("se")) .findFirst() .map(pair -> pair[1]) .map(expirationTimeStr -> { try { l...
return OffsetDateTime.MAX;
private OffsetDateTime getExpirationTime(String sharedAccessSignature) { String[] parts = sharedAccessSignature.split("&"); return Arrays.stream(parts) .map(part -> part.split("=")) .filter(pair -> pair.length == 2 && pair[0].equalsIgnoreCase("se")) .findFirst() .map(pair -> pair[1]) .map(expirationTimeStr -> { try { l...
class ServiceBusSharedKeyCredential implements TokenCredential { private static final String SHARED_ACCESS_SIGNATURE_FORMAT = "SharedAccessSignature sr=%s&sig=%s&se=%s&skn=%s"; private static final String HASH_ALGORITHM = "HMACSHA256"; private final ClientLogger logger = new ClientLogger(ServiceBusSharedKeyCredential.c...
class ServiceBusSharedKeyCredential implements TokenCredential { private static final String SHARED_ACCESS_SIGNATURE_FORMAT = "SharedAccessSignature sr=%s&sig=%s&se=%s&skn=%s"; private static final String HASH_ALGORITHM = "HMACSHA256"; private final ClientLogger logger = new ClientLogger(ServiceBusSharedKeyCredential.c...
In Update flow, code changes the Map to add new items.
private void normalizeProperties() { this.hostNameBindingsToDelete = new ArrayList<>(); this.appSettingsToAdd = new HashMap<>(); this.appSettingsToRemove = new ArrayList<>(); this.appSettingStickiness = new HashMap<>(); this.connectionStringsToAdd = new HashMap<>(); this.connectionStringsToRemove = new ArrayList<>(); t...
this.hostNameSslStateMap = new HashMap<>(this.webSiteBase.hostnameSslStates());
private void normalizeProperties() { this.hostNameBindingsToCreate = new TreeMap<>(); this.hostNameBindingsToDelete = new ArrayList<>(); this.appSettingsToAdd = new HashMap<>(); this.appSettingsToRemove = new ArrayList<>(); this.appSettingStickiness = new HashMap<>(); this.connectionStringsToAdd = new HashMap<>(); this...
class WebAppBaseImpl<FluentT extends WebAppBase, FluentImplT extends WebAppBaseImpl<FluentT, FluentImplT>> extends GroupableResourceImpl<FluentT, SiteInner, FluentImplT, AppServiceManager> implements WebAppBase, WebAppBase.Definition<FluentT>, WebAppBase.Update<FluentT>, WebAppBase.UpdateStages.WithWebContainer<FluentT...
class WebAppBaseImpl<FluentT extends WebAppBase, FluentImplT extends WebAppBaseImpl<FluentT, FluentImplT>> extends GroupableResourceImpl<FluentT, SiteInner, FluentImplT, AppServiceManager> implements WebAppBase, WebAppBase.Definition<FluentT>, WebAppBase.Update<FluentT>, WebAppBase.UpdateStages.WithWebContainer<FluentT...
Then should we just use it to save the update items?
private void normalizeProperties() { this.hostNameBindingsToDelete = new ArrayList<>(); this.appSettingsToAdd = new HashMap<>(); this.appSettingsToRemove = new ArrayList<>(); this.appSettingStickiness = new HashMap<>(); this.connectionStringsToAdd = new HashMap<>(); this.connectionStringsToRemove = new ArrayList<>(); t...
this.hostNameSslStateMap = new HashMap<>(this.webSiteBase.hostnameSslStates());
private void normalizeProperties() { this.hostNameBindingsToCreate = new TreeMap<>(); this.hostNameBindingsToDelete = new ArrayList<>(); this.appSettingsToAdd = new HashMap<>(); this.appSettingsToRemove = new ArrayList<>(); this.appSettingStickiness = new HashMap<>(); this.connectionStringsToAdd = new HashMap<>(); this...
class WebAppBaseImpl<FluentT extends WebAppBase, FluentImplT extends WebAppBaseImpl<FluentT, FluentImplT>> extends GroupableResourceImpl<FluentT, SiteInner, FluentImplT, AppServiceManager> implements WebAppBase, WebAppBase.Definition<FluentT>, WebAppBase.Update<FluentT>, WebAppBase.UpdateStages.WithWebContainer<FluentT...
class WebAppBaseImpl<FluentT extends WebAppBase, FluentImplT extends WebAppBaseImpl<FluentT, FluentImplT>> extends GroupableResourceImpl<FluentT, SiteInner, FluentImplT, AppServiceManager> implements WebAppBase, WebAppBase.Definition<FluentT>, WebAppBase.Update<FluentT>, WebAppBase.UpdateStages.WithWebContainer<FluentT...
Yes. Hence I keep it there. I.e., WebSiteBase init the variable (instead of previous code in this method), then logic remains same as before.
private void normalizeProperties() { this.hostNameBindingsToDelete = new ArrayList<>(); this.appSettingsToAdd = new HashMap<>(); this.appSettingsToRemove = new ArrayList<>(); this.appSettingStickiness = new HashMap<>(); this.connectionStringsToAdd = new HashMap<>(); this.connectionStringsToRemove = new ArrayList<>(); t...
this.hostNameSslStateMap = new HashMap<>(this.webSiteBase.hostnameSslStates());
private void normalizeProperties() { this.hostNameBindingsToCreate = new TreeMap<>(); this.hostNameBindingsToDelete = new ArrayList<>(); this.appSettingsToAdd = new HashMap<>(); this.appSettingsToRemove = new ArrayList<>(); this.appSettingStickiness = new HashMap<>(); this.connectionStringsToAdd = new HashMap<>(); this...
class WebAppBaseImpl<FluentT extends WebAppBase, FluentImplT extends WebAppBaseImpl<FluentT, FluentImplT>> extends GroupableResourceImpl<FluentT, SiteInner, FluentImplT, AppServiceManager> implements WebAppBase, WebAppBase.Definition<FluentT>, WebAppBase.Update<FluentT>, WebAppBase.UpdateStages.WithWebContainer<FluentT...
class WebAppBaseImpl<FluentT extends WebAppBase, FluentImplT extends WebAppBaseImpl<FluentT, FluentImplT>> extends GroupableResourceImpl<FluentT, SiteInner, FluentImplT, AppServiceManager> implements WebAppBase, WebAppBase.Definition<FluentT>, WebAppBase.Update<FluentT>, WebAppBase.UpdateStages.WithWebContainer<FluentT...
Done
public Flux<String> deleteByIdsAsync(Collection<String> ids) { if (ids == null || ids.isEmpty()) { return Flux.empty(); } Collection<Mono<String>> observables = new ArrayList<>(); for (String id : ids) { final String resourceGroupName = ResourceUtils.groupFromResourceId(id); final String name = ResourceUtils.nameFromRe...
return Flux.mergeDelayError(32, observables.toArray(new Mono[0]));
public Flux<String> deleteByIdsAsync(Collection<String> ids) { return BatchDeletionImpl.deleteByIdsAsync(ids, this::deleteInnerAsync); }
class WebAppsImpl extends GroupableResourcesImpl<WebApp, WebAppImpl, SiteInner, WebAppsClient, AppServiceManager> implements WebApps, SupportsBatchDeletion { public WebAppsImpl(final AppServiceManager manager) { super(manager.inner().getWebApps(), manager); } @Override public Mono<WebApp> getByResourceGroupAsync(final ...
class WebAppsImpl extends GroupableResourcesImpl<WebApp, WebAppImpl, SiteInner, WebAppsClient, AppServiceManager> implements WebApps, SupportsBatchDeletion { public WebAppsImpl(final AppServiceManager manager) { super(manager.inner().getWebApps(), manager); } @Override public Mono<WebApp> getByResourceGroupAsync(final ...
If no order needed, use `Flux.mergeDelayError`
public Mono<CdnEndpoint> updateResourceAsync() { final CdnEndpointImpl self = this; EndpointUpdateParameters endpointUpdateParameters = new EndpointUpdateParameters(); endpointUpdateParameters.withIsHttpAllowed(this.inner().isHttpAllowed()) .withIsHttpsAllowed(this.inner().isHttpsAllowed()) .withOriginPath(this.inner()...
Flux<CustomDomainInner> customDomainTask = Flux.concat(customDomainCreateTask, customDomainDeleteTask);
public Mono<CdnEndpoint> updateResourceAsync() { final CdnEndpointImpl self = this; EndpointUpdateParameters endpointUpdateParameters = new EndpointUpdateParameters(); endpointUpdateParameters.withIsHttpAllowed(this.inner().isHttpAllowed()) .withIsHttpsAllowed(this.inner().isHttpsAllowed()) .withOriginPath(this.inner()...
class CdnEndpointImpl extends ExternalChildResourceImpl< CdnEndpoint, EndpointInner, CdnProfileImpl, CdnProfile> implements CdnEndpoint, CdnEndpoint.DefinitionStages.Blank.StandardEndpoint<CdnProfile.DefinitionStages.WithStandardCreate>, CdnEndpoint.DefinitionStages.Blank.PremiumEndpoint<CdnProfile.DefinitionStages.Wit...
class CdnEndpointImpl extends ExternalChildResourceImpl< CdnEndpoint, EndpointInner, CdnProfileImpl, CdnProfile> implements CdnEndpoint, CdnEndpoint.DefinitionStages.Blank.StandardEndpoint<CdnProfile.DefinitionStages.WithStandardCreate>, CdnEndpoint.DefinitionStages.Blank.PremiumEndpoint<CdnProfile.DefinitionStages.Wit...
If no order needed, use `Flux.mergeDelayError(customDomainTask.then(), originUpdateTask.then(), endpointUpdateTask)`, for parallel
public Mono<CdnEndpoint> updateResourceAsync() { final CdnEndpointImpl self = this; EndpointUpdateParameters endpointUpdateParameters = new EndpointUpdateParameters(); endpointUpdateParameters.withIsHttpAllowed(this.inner().isHttpAllowed()) .withIsHttpsAllowed(this.inner().isHttpsAllowed()) .withOriginPath(this.inner()...
return customDomainTask.then(originUpdateTask).then(endpointUpdateTask)
public Mono<CdnEndpoint> updateResourceAsync() { final CdnEndpointImpl self = this; EndpointUpdateParameters endpointUpdateParameters = new EndpointUpdateParameters(); endpointUpdateParameters.withIsHttpAllowed(this.inner().isHttpAllowed()) .withIsHttpsAllowed(this.inner().isHttpsAllowed()) .withOriginPath(this.inner()...
class CdnEndpointImpl extends ExternalChildResourceImpl< CdnEndpoint, EndpointInner, CdnProfileImpl, CdnProfile> implements CdnEndpoint, CdnEndpoint.DefinitionStages.Blank.StandardEndpoint<CdnProfile.DefinitionStages.WithStandardCreate>, CdnEndpoint.DefinitionStages.Blank.PremiumEndpoint<CdnProfile.DefinitionStages.Wit...
class CdnEndpointImpl extends ExternalChildResourceImpl< CdnEndpoint, EndpointInner, CdnProfileImpl, CdnProfile> implements CdnEndpoint, CdnEndpoint.DefinitionStages.Blank.StandardEndpoint<CdnProfile.DefinitionStages.WithStandardCreate>, CdnEndpoint.DefinitionStages.Blank.PremiumEndpoint<CdnProfile.DefinitionStages.Wit...
The concern to have concat came from [Azure/azure-libraries-for-net#891](https://github.com/Azure/azure-libraries-for-net/issues/891). For safe, I just concat the custom domain tasks. For tasks of different resources, we can use merge.
public Mono<CdnEndpoint> updateResourceAsync() { final CdnEndpointImpl self = this; EndpointUpdateParameters endpointUpdateParameters = new EndpointUpdateParameters(); endpointUpdateParameters.withIsHttpAllowed(this.inner().isHttpAllowed()) .withIsHttpsAllowed(this.inner().isHttpsAllowed()) .withOriginPath(this.inner()...
Flux<CustomDomainInner> customDomainTask = Flux.concat(customDomainCreateTask, customDomainDeleteTask);
public Mono<CdnEndpoint> updateResourceAsync() { final CdnEndpointImpl self = this; EndpointUpdateParameters endpointUpdateParameters = new EndpointUpdateParameters(); endpointUpdateParameters.withIsHttpAllowed(this.inner().isHttpAllowed()) .withIsHttpsAllowed(this.inner().isHttpsAllowed()) .withOriginPath(this.inner()...
class CdnEndpointImpl extends ExternalChildResourceImpl< CdnEndpoint, EndpointInner, CdnProfileImpl, CdnProfile> implements CdnEndpoint, CdnEndpoint.DefinitionStages.Blank.StandardEndpoint<CdnProfile.DefinitionStages.WithStandardCreate>, CdnEndpoint.DefinitionStages.Blank.PremiumEndpoint<CdnProfile.DefinitionStages.Wit...
class CdnEndpointImpl extends ExternalChildResourceImpl< CdnEndpoint, EndpointInner, CdnProfileImpl, CdnProfile> implements CdnEndpoint, CdnEndpoint.DefinitionStages.Blank.StandardEndpoint<CdnProfile.DefinitionStages.WithStandardCreate>, CdnEndpoint.DefinitionStages.Blank.PremiumEndpoint<CdnProfile.DefinitionStages.Wit...
Updated.
public Mono<CdnEndpoint> updateResourceAsync() { final CdnEndpointImpl self = this; EndpointUpdateParameters endpointUpdateParameters = new EndpointUpdateParameters(); endpointUpdateParameters.withIsHttpAllowed(this.inner().isHttpAllowed()) .withIsHttpsAllowed(this.inner().isHttpsAllowed()) .withOriginPath(this.inner()...
return customDomainTask.then(originUpdateTask).then(endpointUpdateTask)
public Mono<CdnEndpoint> updateResourceAsync() { final CdnEndpointImpl self = this; EndpointUpdateParameters endpointUpdateParameters = new EndpointUpdateParameters(); endpointUpdateParameters.withIsHttpAllowed(this.inner().isHttpAllowed()) .withIsHttpsAllowed(this.inner().isHttpsAllowed()) .withOriginPath(this.inner()...
class CdnEndpointImpl extends ExternalChildResourceImpl< CdnEndpoint, EndpointInner, CdnProfileImpl, CdnProfile> implements CdnEndpoint, CdnEndpoint.DefinitionStages.Blank.StandardEndpoint<CdnProfile.DefinitionStages.WithStandardCreate>, CdnEndpoint.DefinitionStages.Blank.PremiumEndpoint<CdnProfile.DefinitionStages.Wit...
class CdnEndpointImpl extends ExternalChildResourceImpl< CdnEndpoint, EndpointInner, CdnProfileImpl, CdnProfile> implements CdnEndpoint, CdnEndpoint.DefinitionStages.Blank.StandardEndpoint<CdnProfile.DefinitionStages.WithStandardCreate>, CdnEndpoint.DefinitionStages.Blank.PremiumEndpoint<CdnProfile.DefinitionStages.Wit...
does `queryNextPage` need the query string again?
public PagedFlux<String> query(String query) { return new PagedFlux<>( () -> withContext(context -> queryFirstPage(query, context)), nextLink -> withContext(context -> queryNextPage(query, nextLink, context))); }
nextLink -> withContext(context -> queryNextPage(query, nextLink, context)));
public PagedFlux<String> query(String query) { return new PagedFlux<>( () -> withContext(context -> queryFirstPage(query, context)), nextLink -> withContext(context -> queryNextPage(nextLink, context))); }
class to deserialize the application/json component into. * @param <T> The generic type to deserialize the component to. * @return A {@link DigitalTwinsResponse}
class to deserialize the application/json component into. * @param <T> The generic type to deserialize the component to. * @return A {@link DigitalTwinsResponse}
Doesn't `QuerySpecification` have fluent setters?
Mono<PagedResponse<String>> queryFirstPage(String query, Context context) { QuerySpecification querySpecification = new QuerySpecification(); querySpecification .setQuery(query); return protocolLayer .getQueries() .queryTwinsWithResponseAsync(querySpecification, context) .map(objectPagedResponse -> new PagedResponseBas...
querySpecification
new QuerySpecification().setQuery(query); return protocolLayer .getQueries() .queryTwinsWithResponseAsync(querySpecification, context) .map(objectPagedResponse -> new PagedResponseBase<>( objectPagedResponse.getRequest(), objectPagedResponse.getStatusCode(), objectPagedResponse.getHeaders(), objectPagedResponse.getValu...
class to convert the query response to. * @param <T> The generic type to convert the query response to. * @return A {@link PagedFlux}
class to convert the query response to. * @param <T> The generic type to convert the query response to. * @return A {@link PagedFlux}