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
why sdk version hardcoded?
public Context getContext() { if (sdkName == null) { sdkName = this.getClass().getPackage().getName(); } return new Context("Sdk-Name", sdkName) .addData("Sdk-Version", SDK_VERSION); }
.addData("Sdk-Version", SDK_VERSION);
public Context getContext() { return new Context("Sdk-Name", sdkName) .addData("Sdk-Version", SDK_VERSION); }
class AzureServiceClient { private final ClientLogger logger = new ClientLogger(getClass()); protected AzureServiceClient(HttpPipeline httpPipeline, AzureEnvironment environment) { ((AzureJacksonAdapter) serializerAdapter).serializer().registerModule(DateTimeDeserializer.getModule()); } private static final String SDK_...
class AzureServiceClient { private final ClientLogger logger = new ClientLogger(getClass()); private static final Map<String, String> PROPERTIES = CoreUtils.getProperties("azure.properties"); private static final String SDK_VERSION; static { SDK_VERSION = PROPERTIES.getOrDefault("version", "UnknownVersion"); } private ...
there might be other approach. not investigated yet.
public Context getContext() { if (sdkName == null) { sdkName = this.getClass().getPackage().getName(); } return new Context("Sdk-Name", sdkName) .addData("Sdk-Version", SDK_VERSION); }
.addData("Sdk-Version", SDK_VERSION);
public Context getContext() { return new Context("Sdk-Name", sdkName) .addData("Sdk-Version", SDK_VERSION); }
class AzureServiceClient { private final ClientLogger logger = new ClientLogger(getClass()); protected AzureServiceClient(HttpPipeline httpPipeline, AzureEnvironment environment) { ((AzureJacksonAdapter) serializerAdapter).serializer().registerModule(DateTimeDeserializer.getModule()); } private static final String SDK_...
class AzureServiceClient { private final ClientLogger logger = new ClientLogger(getClass()); private static final Map<String, String> PROPERTIES = CoreUtils.getProperties("azure.properties"); private static final String SDK_VERSION; static { SDK_VERSION = PROPERTIES.getOrDefault("version", "UnknownVersion"); } private ...
got it. let's fix it before GA.
public Context getContext() { if (sdkName == null) { sdkName = this.getClass().getPackage().getName(); } return new Context("Sdk-Name", sdkName) .addData("Sdk-Version", SDK_VERSION); }
.addData("Sdk-Version", SDK_VERSION);
public Context getContext() { return new Context("Sdk-Name", sdkName) .addData("Sdk-Version", SDK_VERSION); }
class AzureServiceClient { private final ClientLogger logger = new ClientLogger(getClass()); protected AzureServiceClient(HttpPipeline httpPipeline, AzureEnvironment environment) { ((AzureJacksonAdapter) serializerAdapter).serializer().registerModule(DateTimeDeserializer.getModule()); } private static final String SDK_...
class AzureServiceClient { private final ClientLogger logger = new ClientLogger(getClass()); private static final Map<String, String> PROPERTIES = CoreUtils.getProperties("azure.properties"); private static final String SDK_VERSION; static { SDK_VERSION = PROPERTIES.getOrDefault("version", "UnknownVersion"); } private ...
already fixed in this PR. now the flow is: 1. maven package the project, one step it would populate `azure.properties` with its current `project.version`. 2. jar now has this `azure.properties` packaged and released with the jar 3. runtime, code read version from `azure.properties`
public Context getContext() { if (sdkName == null) { sdkName = this.getClass().getPackage().getName(); } return new Context("Sdk-Name", sdkName) .addData("Sdk-Version", SDK_VERSION); }
.addData("Sdk-Version", SDK_VERSION);
public Context getContext() { return new Context("Sdk-Name", sdkName) .addData("Sdk-Version", SDK_VERSION); }
class AzureServiceClient { private final ClientLogger logger = new ClientLogger(getClass()); protected AzureServiceClient(HttpPipeline httpPipeline, AzureEnvironment environment) { ((AzureJacksonAdapter) serializerAdapter).serializer().registerModule(DateTimeDeserializer.getModule()); } private static final String SDK_...
class AzureServiceClient { private final ClientLogger logger = new ClientLogger(getClass()); private static final Map<String, String> PROPERTIES = CoreUtils.getProperties("azure.properties"); private static final String SDK_VERSION; static { SDK_VERSION = PROPERTIES.getOrDefault("version", "UnknownVersion"); } private ...
I think options can be null here, right?
Mono<Response<String>> renewLeaseWithResponse(BlobRenewLeaseOptions options, Context context) { StorageImplUtils.assertNotNull("options", options); BlobLeaseRequestConditions requestConditions = (options.getRequestConditions() == null) ? new BlobLeaseRequestConditions() : options.getRequestConditions(); context = conte...
StorageImplUtils.assertNotNull("options", options);
new BlobLeaseRequestConditions() : options.getRequestConditions(); context = context == null ? Context.NONE : context; if (this.isBlob) { return this.client.blobs().acquireLeaseWithRestResponseAsync(null, null, null, options.getDuration(), this.leaseId, requestConditions.getIfModifiedSince(), requestConditions.getIfUnm...
class BlobLeaseAsyncClient { private final ClientLogger logger = new ClientLogger(BlobLeaseAsyncClient.class); private final boolean isBlob; private final String leaseId; private final AzureBlobStorageImpl client; private final String accountName; BlobLeaseAsyncClient(HttpPipeline pipeline, String url, String leaseId, ...
class BlobLeaseAsyncClient { private final ClientLogger logger = new ClientLogger(BlobLeaseAsyncClient.class); private final boolean isBlob; private final String leaseId; private final AzureBlobStorageImpl client; private final String accountName; BlobLeaseAsyncClient(HttpPipeline pipeline, String url, String leaseId, ...
Should be in `finally`?
private static void extraTarGzSource(File folder, URL url) throws IOException { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.connect(); try (TarArchiveInputStream inputStream = new TarArchiveInputStream(new GzipCompressorInputStream(connection.getInputStream()))) { TarArchiveEntry...
connection.disconnect();
private static void extraTarGzSource(File folder, URL url) throws IOException { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.connect(); try (TarArchiveInputStream inputStream = new TarArchiveInputStream(new GzipCompressorInputStream(connection.getInputStream()))) { TarArchiveEntry...
class ManageSpringCloud { private static final String PIGGYMETRICS_TAR_GZ_URL = "https: private static final String SPRING_CLOUD_SERVICE_PRINCIPAL = "03b39d0f-4213-4864-a245-b1476ec03169"; /** * Main function which runs the actual sample. * @param azure instance of the azure client * @param clientId the aad client id i...
class ManageSpringCloud { private static final String PIGGYMETRICS_TAR_GZ_URL = "https: private static final String SPRING_CLOUD_SERVICE_PRINCIPAL = "03b39d0f-4213-4864-a245-b1476ec03169"; /** * Main function which runs the actual sample. * @param azure instance of the azure client * @param clientId the aad client id i...
done
private static void extraTarGzSource(File folder, URL url) throws IOException { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.connect(); try (TarArchiveInputStream inputStream = new TarArchiveInputStream(new GzipCompressorInputStream(connection.getInputStream()))) { TarArchiveEntry...
connection.disconnect();
private static void extraTarGzSource(File folder, URL url) throws IOException { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.connect(); try (TarArchiveInputStream inputStream = new TarArchiveInputStream(new GzipCompressorInputStream(connection.getInputStream()))) { TarArchiveEntry...
class ManageSpringCloud { private static final String PIGGYMETRICS_TAR_GZ_URL = "https: private static final String SPRING_CLOUD_SERVICE_PRINCIPAL = "03b39d0f-4213-4864-a245-b1476ec03169"; /** * Main function which runs the actual sample. * @param azure instance of the azure client * @param clientId the aad client id i...
class ManageSpringCloud { private static final String PIGGYMETRICS_TAR_GZ_URL = "https: private static final String SPRING_CLOUD_SERVICE_PRINCIPAL = "03b39d0f-4213-4864-a245-b1476ec03169"; /** * Main function which runs the actual sample. * @param azure instance of the azure client * @param clientId the aad client id i...
Any reason for commenting this out? Looks like the poller tests should not be impacted by this PR.
public void lroTimeout() { final Duration timeoutDuration = Duration.ofMillis(1000); final String resourceEndpoint = "/resource/1"; final AtomicInteger getCallCount = new AtomicInteger(0); ResponseTransformer provisioningStateLroService = new ResponseTransformer() { @Override public com.github.tomakehurst.wiremock.http...
public void lroTimeout() { final Duration timeoutDuration = Duration.ofMillis(1000); final String resourceEndpoint = "/resource/1"; final AtomicInteger getCallCount = new AtomicInteger(0); ResponseTransformer provisioningStateLroService = new ResponseTransformer() { @Override public com.github.tomakehurst.wiremock.http...
class LROPollerTests { private static final SerializerAdapter SERIALIZER = new AzureJacksonAdapter(); private static final Duration POLLING_DURATION = Duration.ofMillis(100); @BeforeEach public void beforeTest() { MockitoAnnotations.initMocks(this); } @AfterEach public void afterTest() { Mockito.framework().clearInline...
class LROPollerTests { private static final SerializerAdapter SERIALIZER = new AzureJacksonAdapter(); private static final Duration POLLING_DURATION = Duration.ofMillis(100); @BeforeEach public void beforeTest() { MockitoAnnotations.initMocks(this); } @AfterEach public void afterTest() { Mockito.framework().clearInline...
These have been fixed and merged in after the commit this branch was checked out from. Cherry picked to make it so CI fails less.
public void lroTimeout() { final Duration timeoutDuration = Duration.ofMillis(1000); final String resourceEndpoint = "/resource/1"; final AtomicInteger getCallCount = new AtomicInteger(0); ResponseTransformer provisioningStateLroService = new ResponseTransformer() { @Override public com.github.tomakehurst.wiremock.http...
public void lroTimeout() { final Duration timeoutDuration = Duration.ofMillis(1000); final String resourceEndpoint = "/resource/1"; final AtomicInteger getCallCount = new AtomicInteger(0); ResponseTransformer provisioningStateLroService = new ResponseTransformer() { @Override public com.github.tomakehurst.wiremock.http...
class LROPollerTests { private static final SerializerAdapter SERIALIZER = new AzureJacksonAdapter(); private static final Duration POLLING_DURATION = Duration.ofMillis(100); @BeforeEach public void beforeTest() { MockitoAnnotations.initMocks(this); } @AfterEach public void afterTest() { Mockito.framework().clearInline...
class LROPollerTests { private static final SerializerAdapter SERIALIZER = new AzureJacksonAdapter(); private static final Duration POLLING_DURATION = Duration.ofMillis(100); @BeforeEach public void beforeTest() { MockitoAnnotations.initMocks(this); } @AfterEach public void afterTest() { Mockito.framework().clearInline...
This should be an NPE rather than IllegalArgument. https://azure.github.io/azure-sdk/java_implementation.html#java-errors-system-errors
boolean tryAdd(final EventData eventData) { if (eventData == null) { throw logger.logExceptionAsWarning(new IllegalArgumentException("eventData cannot be null")); } EventData event = tracerProvider.isEnabled() ? traceMessageSpan(eventData) : eventData; final int size; try { size = getSize(event, events.isEmpty()); } ca...
throw logger.logExceptionAsWarning(new IllegalArgumentException("eventData cannot be null"));
boolean tryAdd(final EventData eventData) { if (eventData == null) { throw logger.logExceptionAsWarning(new NullPointerException("eventData cannot be null")); } EventData event = tracerProvider.isEnabled() ? traceMessageSpan(eventData) : eventData; final int size; try { size = getSize(event, events.isEmpty()); } catch ...
class EventDataBatchBase { private final ClientLogger logger = new ClientLogger(this.getClass()); private final Object lock = new Object(); private final int maxMessageSize; private final String partitionKey; private final ErrorContextProvider contextProvider; private final List<EventData> events; private final byte[] ...
class EventDataBatchBase { private final ClientLogger logger = new ClientLogger(this.getClass()); private final Object lock = new Object(); private final int maxMessageSize; private final String partitionKey; private final ErrorContextProvider contextProvider; private final List<EventData> events; private final byte[] ...
fixed, thanks Connie
boolean tryAdd(final EventData eventData) { if (eventData == null) { throw logger.logExceptionAsWarning(new IllegalArgumentException("eventData cannot be null")); } EventData event = tracerProvider.isEnabled() ? traceMessageSpan(eventData) : eventData; final int size; try { size = getSize(event, events.isEmpty()); } ca...
throw logger.logExceptionAsWarning(new IllegalArgumentException("eventData cannot be null"));
boolean tryAdd(final EventData eventData) { if (eventData == null) { throw logger.logExceptionAsWarning(new NullPointerException("eventData cannot be null")); } EventData event = tracerProvider.isEnabled() ? traceMessageSpan(eventData) : eventData; final int size; try { size = getSize(event, events.isEmpty()); } catch ...
class EventDataBatchBase { private final ClientLogger logger = new ClientLogger(this.getClass()); private final Object lock = new Object(); private final int maxMessageSize; private final String partitionKey; private final ErrorContextProvider contextProvider; private final List<EventData> events; private final byte[] ...
class EventDataBatchBase { private final ClientLogger logger = new ClientLogger(this.getClass()); private final Object lock = new Object(); private final int maxMessageSize; private final String partitionKey; private final ErrorContextProvider contextProvider; private final List<EventData> events; private final byte[] ...
Track1 does this ``` private Observable<VirtualMachineInner> retrieveVirtualMachineAsync() { return this.computeManager .inner() .virtualMachines() .getByResourceGroupAsync(rgName, vmName, InstanceViewTypes.INSTANCE_VIEW) .flatMap(new Func1<Vi...
private Mono<VirtualMachineInner> retrieveVirtualMachineAsync() { return this .computeManager .inner() .getVirtualMachines() .getByResourceGroupAsync(rgName, vmName); }
}
private Mono<VirtualMachineInner> retrieveVirtualMachineAsync() { return this .computeManager .inner() .getVirtualMachines() .getByResourceGroupAsync(rgName, vmName); }
class WindowsVolumeNoAADEncryptionMonitorImpl implements DiskVolumeEncryptionMonitor { private final String rgName; private final String vmName; private final ComputeManager computeManager; private VirtualMachineInner virtualMachine; WindowsVolumeNoAADEncryptionMonitorImpl(String virtualMachineId, ComputeManager comput...
class WindowsVolumeNoAADEncryptionMonitorImpl implements DiskVolumeEncryptionMonitor { private final String rgName; private final String vmName; private final ComputeManager computeManager; private VirtualMachineInner virtualMachine; WindowsVolumeNoAADEncryptionMonitorImpl(String virtualMachineId, ComputeManager comput...
I think it could just be removed, due to other list will not deal with 404.
public PagedFlux<VirtualMachineExtensionImage> listByRegionAsync(String regionName) { return PagedConverter .flatMapPage( publishers.listByRegionAsync(regionName), virtualMachinePublisher -> virtualMachinePublisher .extensionTypes() .listAsync() .onErrorResume(ManagementException.class, e -> e.getResponse().getStatusCo...
e -> e.getResponse().getStatusCode() == 404 ? Flux.empty() : Flux.error(e))
public PagedFlux<VirtualMachineExtensionImage> listByRegionAsync(String regionName) { return PagedConverter .flatMapPage( publishers.listByRegionAsync(regionName), virtualMachinePublisher -> virtualMachinePublisher .extensionTypes() .listAsync() .onErrorResume(ManagementException.class, e -> e.getResponse().getStatusCo...
class VirtualMachineExtensionImagesImpl implements VirtualMachineExtensionImages { private final VirtualMachinePublishers publishers; public VirtualMachineExtensionImagesImpl(VirtualMachinePublishers publishers) { this.publishers = publishers; } @Override public PagedIterable<VirtualMachineExtensionImage> listByRegion(...
class VirtualMachineExtensionImagesImpl implements VirtualMachineExtensionImages { private final VirtualMachinePublishers publishers; public VirtualMachineExtensionImagesImpl(VirtualMachinePublishers publishers) { this.publishers = publishers; } @Override public PagedIterable<VirtualMachineExtensionImage> listByRegion(...
same as above
public PagedFlux<VirtualMachineImage> listByRegionAsync(String regionName) { return PagedConverter .flatMapPage( publishers().listByRegionAsync(regionName), virtualMachinePublisher -> virtualMachinePublisher .offers() .listAsync() .onErrorResume(ManagementException.class, e -> e.getResponse().getStatusCode() == 404 ? F...
e -> e.getResponse().getStatusCode() == 404 ? Flux.empty() : Flux.error(e))
public PagedFlux<VirtualMachineImage> listByRegionAsync(String regionName) { return PagedConverter .flatMapPage( publishers().listByRegionAsync(regionName), virtualMachinePublisher -> virtualMachinePublisher .offers() .listAsync() .onErrorResume(ManagementException.class, e -> e.getResponse().getStatusCode() == 404 ? F...
class VirtualMachineImagesImpl implements VirtualMachineImages { private final VirtualMachinePublishers publishers; private final VirtualMachineImagesClient client; public VirtualMachineImagesImpl(VirtualMachinePublishers publishers, VirtualMachineImagesClient client) { this.publishers = publishers; this.client = clien...
class VirtualMachineImagesImpl implements VirtualMachineImages { private final VirtualMachinePublishers publishers; private final VirtualMachineImagesClient client; public VirtualMachineImagesImpl(VirtualMachinePublishers publishers, VirtualMachineImagesClient client) { this.publishers = publishers; this.client = clien...
This is because for 1 or 2 publisher, above list image type would fail with 404 (error on publisher not valid). But apparently we would still want to continue with the other publishers.
public PagedFlux<VirtualMachineExtensionImage> listByRegionAsync(String regionName) { return PagedConverter .flatMapPage( publishers.listByRegionAsync(regionName), virtualMachinePublisher -> virtualMachinePublisher .extensionTypes() .listAsync() .onErrorResume(ManagementException.class, e -> e.getResponse().getStatusCo...
e -> e.getResponse().getStatusCode() == 404 ? Flux.empty() : Flux.error(e))
public PagedFlux<VirtualMachineExtensionImage> listByRegionAsync(String regionName) { return PagedConverter .flatMapPage( publishers.listByRegionAsync(regionName), virtualMachinePublisher -> virtualMachinePublisher .extensionTypes() .listAsync() .onErrorResume(ManagementException.class, e -> e.getResponse().getStatusCo...
class VirtualMachineExtensionImagesImpl implements VirtualMachineExtensionImages { private final VirtualMachinePublishers publishers; public VirtualMachineExtensionImagesImpl(VirtualMachinePublishers publishers) { this.publishers = publishers; } @Override public PagedIterable<VirtualMachineExtensionImage> listByRegion(...
class VirtualMachineExtensionImagesImpl implements VirtualMachineExtensionImages { private final VirtualMachinePublishers publishers; public VirtualMachineExtensionImagesImpl(VirtualMachinePublishers publishers) { this.publishers = publishers; } @Override public PagedIterable<VirtualMachineExtensionImage> listByRegion(...
Why `AtomicReference` over `AtomicInteger`?
public void verifyExceptionPropagationFromPollingOperation() { final Response activationResponse = new Response("Foo"); when(activationOperation.apply(any())) .thenReturn(Mono.defer(() -> Mono.just(activationResponse))); final AtomicReference<Integer> cnt = new AtomicReference<>(0); pollOperation = (pollingContext) -> ...
final AtomicReference<Integer> cnt = new AtomicReference<>(0);
public void verifyExceptionPropagationFromPollingOperation() { final Response activationResponse = new Response("Foo"); when(activationOperation.apply(any())) .thenReturn(Mono.defer(() -> Mono.just(activationResponse))); final AtomicReference<Integer> cnt = new AtomicReference<>(0); pollOperation = (pollingContext) -> ...
class PollerTests { @Mock private Function<PollingContext<Response>, Mono<Response>> activationOperation; @Mock private Function<PollingContext<Response>, Mono<PollResponse<Response>>> activationOperationWithResponse; @Mock private Function<PollingContext<Response>, Mono<PollResponse<Response>>> pollOperation; @Mock pr...
class PollerTests { @Mock private Function<PollingContext<Response>, Mono<Response>> activationOperation; @Mock private Function<PollingContext<Response>, Mono<PollResponse<Response>>> activationOperationWithResponse; @Mock private Function<PollingContext<Response>, Mono<PollResponse<Response>>> pollOperation; @Mock pr...
We could use either..
public void verifyExceptionPropagationFromPollingOperation() { final Response activationResponse = new Response("Foo"); when(activationOperation.apply(any())) .thenReturn(Mono.defer(() -> Mono.just(activationResponse))); final AtomicReference<Integer> cnt = new AtomicReference<>(0); pollOperation = (pollingContext) -> ...
final AtomicReference<Integer> cnt = new AtomicReference<>(0);
public void verifyExceptionPropagationFromPollingOperation() { final Response activationResponse = new Response("Foo"); when(activationOperation.apply(any())) .thenReturn(Mono.defer(() -> Mono.just(activationResponse))); final AtomicReference<Integer> cnt = new AtomicReference<>(0); pollOperation = (pollingContext) -> ...
class PollerTests { @Mock private Function<PollingContext<Response>, Mono<Response>> activationOperation; @Mock private Function<PollingContext<Response>, Mono<PollResponse<Response>>> activationOperationWithResponse; @Mock private Function<PollingContext<Response>, Mono<PollResponse<Response>>> pollOperation; @Mock pr...
class PollerTests { @Mock private Function<PollingContext<Response>, Mono<Response>> activationOperation; @Mock private Function<PollingContext<Response>, Mono<PollResponse<Response>>> activationOperationWithResponse; @Mock private Function<PollingContext<Response>, Mono<PollResponse<Response>>> pollOperation; @Mock pr...
why do we need this `buffer(2)` ?
public Object execute(DocumentQuery query, Class<?> type, String container) { return operations.find(query, type, container) .buffer(2) .map((vals) -> { if (vals.size() > 1) { throw new CosmosAccessException("Too many results - Expected Mono<" + returnedType.getReturnedType() + "> but query returned multiple results");...
.buffer(2)
public Object execute(DocumentQuery query, Class<?> type, String container) { return operations.getContainerName(type); }
class ContainerExecution implements ReactiveCosmosQueryExecution { private final ReactiveCosmosOperations operations; public ContainerExecution(ReactiveCosmosOperations operations) { this.operations = operations; } @Override }
class ContainerExecution implements ReactiveCosmosQueryExecution { private final ReactiveCosmosOperations operations; public ContainerExecution(ReactiveCosmosOperations operations) { this.operations = operations; } @Override }
We want to ensure only a single result is returned by the query. However, the results are returned as a stream. This allows us to check that the stream only contains a single item without retrieving all of the streams contents.
public Object execute(DocumentQuery query, Class<?> type, String container) { return operations.find(query, type, container) .buffer(2) .map((vals) -> { if (vals.size() > 1) { throw new CosmosAccessException("Too many results - Expected Mono<" + returnedType.getReturnedType() + "> but query returned multiple results");...
.buffer(2)
public Object execute(DocumentQuery query, Class<?> type, String container) { return operations.getContainerName(type); }
class ContainerExecution implements ReactiveCosmosQueryExecution { private final ReactiveCosmosOperations operations; public ContainerExecution(ReactiveCosmosOperations operations) { this.operations = operations; } @Override }
class ContainerExecution implements ReactiveCosmosQueryExecution { private final ReactiveCosmosOperations operations; public ContainerExecution(ReactiveCosmosOperations operations) { this.operations = operations; } @Override }
Sounds good!
public Object execute(DocumentQuery query, Class<?> type, String container) { return operations.find(query, type, container) .buffer(2) .map((vals) -> { if (vals.size() > 1) { throw new CosmosAccessException("Too many results - Expected Mono<" + returnedType.getReturnedType() + "> but query returned multiple results");...
.buffer(2)
public Object execute(DocumentQuery query, Class<?> type, String container) { return operations.getContainerName(type); }
class ContainerExecution implements ReactiveCosmosQueryExecution { private final ReactiveCosmosOperations operations; public ContainerExecution(ReactiveCosmosOperations operations) { this.operations = operations; } @Override }
class ContainerExecution implements ReactiveCosmosQueryExecution { private final ReactiveCosmosOperations operations; public ContainerExecution(ReactiveCosmosOperations operations) { this.operations = operations; } @Override }
Do we need to consider (now or later) extending the pattern-matching algorithm to cover standard java networking properties formats? Reactor-netty claims to cover those cases [here](https://github.com/reactor/reactor-netty/blob/a07a8b95488ff2960ea551f4f205d3c7e6277734/src/main/java/reactor/netty/transport/ProxyProvider...
private boolean shouldApplyProxy(SocketAddress socketAddress) { if (nonProxyHostsPattern == null) { return true; } if (!(socketAddress instanceof InetSocketAddress)) { return true; } InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; return !nonProxyHostsPattern.matcher(inetSocketAddress.getHostN...
return !nonProxyHostsPattern.matcher(inetSocketAddress.getHostName()).matches();
private boolean shouldApplyProxy(SocketAddress socketAddress) { if (nonProxyHostsPattern == null) { return true; } if (!(socketAddress instanceof InetSocketAddress)) { return true; } InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; return !nonProxyHostsPattern.matcher(inetSocketAddress.getHostN...
class DeferredHttpProxyProvider implements Function<Bootstrap, BiConsumer<ConnectionObserver, Channel>> { private final AuthorizationChallengeHandler challengeHandler; private final AtomicReference<ChallengeHolder> proxyChallengeHolderReference; private final InetSocketAddress proxyAddress; private final String usernam...
class DeferredHttpProxyProvider implements Function<Bootstrap, BiConsumer<ConnectionObserver, Channel>> { private final AuthorizationChallengeHandler challengeHandler; private final AtomicReference<ChallengeHolder> proxyChallengeHolderReference; private final InetSocketAddress proxyAddress; private final String usernam...
There is more work that is required around non proxy hosts, should roll that into this issue: https://github.com/Azure/azure-sdk-for-java/issues/7795
private boolean shouldApplyProxy(SocketAddress socketAddress) { if (nonProxyHostsPattern == null) { return true; } if (!(socketAddress instanceof InetSocketAddress)) { return true; } InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; return !nonProxyHostsPattern.matcher(inetSocketAddress.getHostN...
return !nonProxyHostsPattern.matcher(inetSocketAddress.getHostName()).matches();
private boolean shouldApplyProxy(SocketAddress socketAddress) { if (nonProxyHostsPattern == null) { return true; } if (!(socketAddress instanceof InetSocketAddress)) { return true; } InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; return !nonProxyHostsPattern.matcher(inetSocketAddress.getHostN...
class DeferredHttpProxyProvider implements Function<Bootstrap, BiConsumer<ConnectionObserver, Channel>> { private final AuthorizationChallengeHandler challengeHandler; private final AtomicReference<ChallengeHolder> proxyChallengeHolderReference; private final InetSocketAddress proxyAddress; private final String usernam...
class DeferredHttpProxyProvider implements Function<Bootstrap, BiConsumer<ConnectionObserver, Channel>> { private final AuthorizationChallengeHandler challengeHandler; private final AtomicReference<ChallengeHolder> proxyChallengeHolderReference; private final InetSocketAddress proxyAddress; private final String usernam...
Can we add a unit test for this in `CosmosEntityInformationUnitTest.java` class ?
private Field getIdField(Class<?> domainType) { final Field idField; final List<Field> fields = FieldUtils.getFieldsListWithAnnotation(domainType, Id.class); if (fields.isEmpty()) { idField = ReflectionUtils.findField(getJavaType(), Constants.ID_PROPERTY_NAME); } else if (fields.size() == 1) { idField = fields.get(0); ...
&& idField.getType() != int.class
private Field getIdField(Class<?> domainType) { final Field idField; final List<Field> fields = FieldUtils.getFieldsListWithAnnotation(domainType, Id.class); if (fields.isEmpty()) { idField = ReflectionUtils.findField(getJavaType(), Constants.ID_PROPERTY_NAME); } else if (fields.size() == 1) { idField = fields.get(0); ...
class of id type */ @SuppressWarnings("unchecked") public Class<ID> getIdType() { return (Class<ID>) id.getType(); }
class of id type */ @SuppressWarnings("unchecked") public Class<ID> getIdType() { return (Class<ID>) id.getType(); }
Added in CosmosEntityInformationUnitTest, please check
private Field getIdField(Class<?> domainType) { final Field idField; final List<Field> fields = FieldUtils.getFieldsListWithAnnotation(domainType, Id.class); if (fields.isEmpty()) { idField = ReflectionUtils.findField(getJavaType(), Constants.ID_PROPERTY_NAME); } else if (fields.size() == 1) { idField = fields.get(0); ...
&& idField.getType() != int.class
private Field getIdField(Class<?> domainType) { final Field idField; final List<Field> fields = FieldUtils.getFieldsListWithAnnotation(domainType, Id.class); if (fields.isEmpty()) { idField = ReflectionUtils.findField(getJavaType(), Constants.ID_PROPERTY_NAME); } else if (fields.size() == 1) { idField = fields.get(0); ...
class of id type */ @SuppressWarnings("unchecked") public Class<ID> getIdType() { return (Class<ID>) id.getType(); }
class of id type */ @SuppressWarnings("unchecked") public Class<ID> getIdType() { return (Class<ID>) id.getType(); }
Thanks.
private Field getIdField(Class<?> domainType) { final Field idField; final List<Field> fields = FieldUtils.getFieldsListWithAnnotation(domainType, Id.class); if (fields.isEmpty()) { idField = ReflectionUtils.findField(getJavaType(), Constants.ID_PROPERTY_NAME); } else if (fields.size() == 1) { idField = fields.get(0); ...
&& idField.getType() != int.class
private Field getIdField(Class<?> domainType) { final Field idField; final List<Field> fields = FieldUtils.getFieldsListWithAnnotation(domainType, Id.class); if (fields.isEmpty()) { idField = ReflectionUtils.findField(getJavaType(), Constants.ID_PROPERTY_NAME); } else if (fields.size() == 1) { idField = fields.get(0); ...
class of id type */ @SuppressWarnings("unchecked") public Class<ID> getIdType() { return (Class<ID>) id.getType(); }
class of id type */ @SuppressWarnings("unchecked") public Class<ID> getIdType() { return (Class<ID>) id.getType(); }
It would be good to add some samples that show what Context is used for.
public static void main(String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); File analyzeFile = new File("../formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/" + "forms/Form_...
.setPollInterval(Duration.ofSeconds(5)), Context.NONE)
public static void main(String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); File analyzeFile = new File("../formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/" + "forms/Form_...
class AdvancedDiffLabeledUnlabeledData { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. * * @throws IOException Exception thrown when there is an error in reading all the bytes from the File. */ }
class AdvancedDiffLabeledUnlabeledData { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. * * @throws IOException Exception thrown when there is an error in reading all the bytes from the File. */ }
Was thinking of holding off on this change until we have the underlying implementation for full context passing support.
public static void main(String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); File analyzeFile = new File("../formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/" + "forms/Form_...
.setPollInterval(Duration.ofSeconds(5)), Context.NONE)
public static void main(String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); File analyzeFile = new File("../formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/" + "forms/Form_...
class AdvancedDiffLabeledUnlabeledData { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. * * @throws IOException Exception thrown when there is an error in reading all the bytes from the File. */ }
class AdvancedDiffLabeledUnlabeledData { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. * * @throws IOException Exception thrown when there is an error in reading all the bytes from the File. */ }
I think these examples need to be more concise seeing they get injected into javadocs esp, it can make the javdocs pretty verbose.
public void analyzeSentimentWithLanguageWithOpinionMining() { final DocumentSentiment documentSentiment = textAnalyticsClient.analyzeSentiment( "The hotel was dark and unclean.", true, "en"); System.out.printf( "Recognized sentiment: %s, positive score: %.2f, neutral score: %.2f, negative score: %.2f.%n", documentSenti...
final DocumentSentiment documentSentiment = textAnalyticsClient.analyzeSentiment(
public void analyzeSentimentWithLanguageWithOpinionMining() { final DocumentSentiment documentSentiment = textAnalyticsClient.analyzeSentiment( "The hotel was dark and unclean.", "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true)); for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences...
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...
Are we only creating the opinion list to print out the size ? Seems like not adding a lot of value. This example could be simplified I think.
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); String document = "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful."; Sy...
System.out.printf("Positive aspects count: %d%n", positiveMinedOpinions.size());
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); String document = "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful."; Sy...
class AnalyzeSentimentWithOpinionMining { /** * Main method to invoke this demo about how to analyze the sentiment of document. * * @param args Unused arguments to the program. */ }
class AnalyzeSentimentWithOpinionMining { /** * Main method to invoke this demo about how to analyze the sentiment of document. * * @param args Unused arguments to the program. */ }
Don't think its a good idea to be making these lists, can't we directly add the content from L508-l513 here? Applicable for all examples below.
public void analyzeSentimentWithLanguageWithOpinionMining() { textAnalyticsAsyncClient.analyzeSentiment("The hotel was dark and unclean.", "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true)) .subscribe(documentSentiment -> { List<MinedOpinion> positiveMinedOpinions = new ArrayList<>(); List<MinedOpinion>...
mixedMinedOpinions.add(minedOpinion);
public void analyzeSentimentWithLanguageWithOpinionMining() { textAnalyticsAsyncClient.analyzeSentiment("The hotel was dark and unclean.", "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true)) .subscribe(documentSentiment -> { for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) { S...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
unused?
public void analyzeSentimentWithLanguageWithOpinionMining() { textAnalyticsAsyncClient.analyzeSentiment("The hotel was dark and unclean.", "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true)) .subscribe(documentSentiment -> { List<MinedOpinion> positiveMinedOpinions = new ArrayList<>(); List<MinedOpinion>...
List<MinedOpinion> mixedMinedOpinions = new ArrayList<>();
public void analyzeSentimentWithLanguageWithOpinionMining() { textAnalyticsAsyncClient.analyzeSentiment("The hotel was dark and unclean.", "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true)) .subscribe(documentSentiment -> { for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) { S...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
Not a good example to show. Please use the options more efficiently or use other overload. Applicable for all examples below.
public void analyzeSentimentStringListWithOptions() { List<String> documents = Arrays.asList( "The hotel was dark and unclean.", "The restaurant had amazing gnocchi." ); textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", (TextAnalyticsRequestOptions) null).subscribe( response -> { TextDocumentBatchStatisti...
textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", (TextAnalyticsRequestOptions) null).subscribe(
public void analyzeSentimentStringListWithOptions() { List<String> documents = Arrays.asList( "The hotel was dark and unclean.", "The restaurant had amazing gnocchi." ); textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", new TextAnalyticsRequestOptions().setIncludeStatistics(true)).subscribe( response -> {...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
Consider providing an empty object
public void analyzeSentimentBatchNullInput() { StepVerifier.create(client.analyzeSentimentBatch(null, null, (TextAnalyticsRequestOptions) null)) .verifyErrorSatisfies(exception -> { assertEquals(NullPointerException.class, exception.getClass()); assertTrue(INVALID_DOCUMENT_BATCH_NPE_MESSAGE.equals(exception.getMessage(...
StepVerifier.create(client.analyzeSentimentBatch(null, null, (TextAnalyticsRequestOptions) null))
public void analyzeSentimentBatchNullInput() { StepVerifier.create(client.analyzeSentimentBatch(null, null, new TextAnalyticsRequestOptions())) .verifyErrorSatisfies(exception -> { assertEquals(NullPointerException.class, exception.getClass()); assertTrue(INVALID_DOCUMENT_BATCH_NPE_MESSAGE.equals(exception.getMessage()...
class DocumentInputAsyncTest { static TextAnalyticsAsyncClient client; @BeforeAll protected static void beforeTest() { client = new TextAnalyticsClientBuilder() .endpoint(VALID_HTTPS_LOCALHOST) .credential(new AzureKeyCredential("fakeKey")) .buildAsyncClient(); } @AfterAll protected static void afterTest() { client = n...
class DocumentInputAsyncTest { static TextAnalyticsAsyncClient client; @BeforeAll protected static void beforeTest() { client = new TextAnalyticsClientBuilder() .endpoint(VALID_HTTPS_LOCALHOST) .credential(new AzureKeyCredential("fakeKey")) .buildAsyncClient(); } @AfterAll protected static void afterTest() { client = n...
We are starting with printing out the size. The for loop, it loops all mined opinions.
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); String document = "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful."; Sy...
System.out.printf("Positive aspects count: %d%n", positiveMinedOpinions.size());
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); String document = "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful."; Sy...
class AnalyzeSentimentWithOpinionMining { /** * Main method to invoke this demo about how to analyze the sentiment of document. * * @param args Unused arguments to the program. */ }
class AnalyzeSentimentWithOpinionMining { /** * Main method to invoke this demo about how to analyze the sentiment of document. * * @param args Unused arguments to the program. */ }
it should be neutral, not mixed. I will fix it.
public void analyzeSentimentWithLanguageWithOpinionMining() { textAnalyticsAsyncClient.analyzeSentiment("The hotel was dark and unclean.", "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true)) .subscribe(documentSentiment -> { List<MinedOpinion> positiveMinedOpinions = new ArrayList<>(); List<MinedOpinion>...
List<MinedOpinion> mixedMinedOpinions = new ArrayList<>();
public void analyzeSentimentWithLanguageWithOpinionMining() { textAnalyticsAsyncClient.analyzeSentiment("The hotel was dark and unclean.", "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true)) .subscribe(documentSentiment -> { for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) { S...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
I am wrong. AspectSentiment and OpinionSentiment could have positive, negative, and mixed. So it should keep as it is.
public void analyzeSentimentWithLanguageWithOpinionMining() { textAnalyticsAsyncClient.analyzeSentiment("The hotel was dark and unclean.", "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true)) .subscribe(documentSentiment -> { List<MinedOpinion> positiveMinedOpinions = new ArrayList<>(); List<MinedOpinion>...
List<MinedOpinion> mixedMinedOpinions = new ArrayList<>();
public void analyzeSentimentWithLanguageWithOpinionMining() { textAnalyticsAsyncClient.analyzeSentiment("The hotel was dark and unclean.", "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true)) .subscribe(documentSentiment -> { for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) { S...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
ignore my last comment. Changed the sample scenarios already.
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); String document = "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful."; Sy...
System.out.printf("Positive aspects count: %d%n", positiveMinedOpinions.size());
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); String document = "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful."; Sy...
class AnalyzeSentimentWithOpinionMining { /** * Main method to invoke this demo about how to analyze the sentiment of document. * * @param args Unused arguments to the program. */ }
class AnalyzeSentimentWithOpinionMining { /** * Main method to invoke this demo about how to analyze the sentiment of document. * * @param args Unused arguments to the program. */ }
updated
public void analyzeSentimentWithLanguageWithOpinionMining() { textAnalyticsAsyncClient.analyzeSentiment("The hotel was dark and unclean.", "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true)) .subscribe(documentSentiment -> { List<MinedOpinion> positiveMinedOpinions = new ArrayList<>(); List<MinedOpinion>...
mixedMinedOpinions.add(minedOpinion);
public void analyzeSentimentWithLanguageWithOpinionMining() { textAnalyticsAsyncClient.analyzeSentiment("The hotel was dark and unclean.", "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true)) .subscribe(documentSentiment -> { for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) { S...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
Did you have to change this because of an error in the compiler or something?
public void analyzeSentimentStringListWithOptions() { List<String> documents = Arrays.asList( "The hotel was dark and unclean.", "The restaurant had amazing gnocchi." ); textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", new TextAnalyticsRequestOptions()).subscribe( response -> { TextDocumentBatchStatistic...
textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", new TextAnalyticsRequestOptions()).subscribe(
public void analyzeSentimentStringListWithOptions() { List<String> documents = Arrays.asList( "The hotel was dark and unclean.", "The restaurant had amazing gnocchi." ); textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", new TextAnalyticsRequestOptions().setIncludeStatistics(true)).subscribe( response -> {...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
it is the opinion that is negated, not the aspect :)
public void analyzeBatchSentimentMaxOverloadWithOpinionMining() { List<TextDocumentInput> textDocumentInputs = Arrays.asList( new TextDocumentInput("1", "The hotel was dark and unclean. The restaurant had amazing gnocchi.") .setLanguage("en"), new TextDocumentInput("2", "The restaurant had amazing gnocchi. The hotel wa...
System.out.printf("\t\t'%s' sentiment because of \"%s\". Is the aspect negated: %s.%n",
public void analyzeBatchSentimentMaxOverloadWithOpinionMining() { List<TextDocumentInput> textDocumentInputs = Arrays.asList( new TextDocumentInput("1", "The hotel was dark and unclean. The restaurant had amazing gnocchi.") .setLanguage("en"), new TextDocumentInput("2", "The restaurant had amazing gnocchi. The hotel wa...
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...
After revisited the purpose of this codesnippet, found set the TextAnalyticsRequestOptions to null is wrong. The purpose of this codesnippet is to show the how to use API with TextAnalyticsRequestOptions. So I will update it to include statistics info.
public void analyzeSentimentStringListWithOptions() { List<String> documents = Arrays.asList( "The hotel was dark and unclean.", "The restaurant had amazing gnocchi." ); textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", new TextAnalyticsRequestOptions()).subscribe( response -> { TextDocumentBatchStatistic...
textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", new TextAnalyticsRequestOptions()).subscribe(
public void analyzeSentimentStringListWithOptions() { List<String> documents = Arrays.asList( "The hotel was dark and unclean.", "The restaurant had amazing gnocchi." ); textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", new TextAnalyticsRequestOptions().setIncludeStatistics(true)).subscribe( response -> {...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
This is final, does it mean it is always null on this model class?
public SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores) { this.text = text; this.sentiment = sentiment; this.minedOpinions = null; this.confidenceScores = confidenceScores; }
this.minedOpinions = null;
public SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores) { this.text = text; this.sentiment = sentiment; this.minedOpinions = null; this.confidenceScores = confidenceScores; }
class SentenceSentiment { private final String text; private final SentimentConfidenceScores confidenceScores; private final TextSentiment sentiment; private final IterableStream<MinedOpinions> minedOpinions; /** * Creates a {@link SentenceSentiment} model that describes the sentiment analysis of sentence. * @param tex...
class SentenceSentiment { private final String text; private final SentimentConfidenceScores confidenceScores; private final TextSentiment sentiment; private final IterableStream<MinedOpinion> minedOpinions; /** * Creates a {@link SentenceSentiment} model that describes the sentiment analysis of sentence. * @param text...
This happens in other places of your tests... I see how you always replace null for TextAnalyticsRequestOptions . if you leave it null, will the code compile? I am asking this because I want to make sure this is not because of the addition of AnalyzeSentimentOptions
public void analyzeSentimentStringListWithOptions() { List<String> documents = Arrays.asList( "The hotel was dark and unclean.", "The restaurant had amazing gnocchi." ); textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", new TextAnalyticsRequestOptions()).subscribe( response -> { TextDocumentBatchStatistic...
textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", new TextAnalyticsRequestOptions()).subscribe(
public void analyzeSentimentStringListWithOptions() { List<String> documents = Arrays.asList( "The hotel was dark and unclean.", "The restaurant had amazing gnocchi." ); textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", new TextAnalyticsRequestOptions().setIncludeStatistics(true)).subscribe( response -> {...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
if user uses this constructor, that means the the minedOpinion will always be null. null minedOpinon means user doesn't want to include opinion mining in the request. empty list of minedOpinion has different meaning. It means the user wants the opinion mining but have no opinion returns, so it is an empty list of opini...
public SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores) { this.text = text; this.sentiment = sentiment; this.minedOpinions = null; this.confidenceScores = confidenceScores; }
this.minedOpinions = null;
public SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores) { this.text = text; this.sentiment = sentiment; this.minedOpinions = null; this.confidenceScores = confidenceScores; }
class SentenceSentiment { private final String text; private final SentimentConfidenceScores confidenceScores; private final TextSentiment sentiment; private final IterableStream<MinedOpinions> minedOpinions; /** * Creates a {@link SentenceSentiment} model that describes the sentiment analysis of sentence. * @param tex...
class SentenceSentiment { private final String text; private final SentimentConfidenceScores confidenceScores; private final TextSentiment sentiment; private final IterableStream<MinedOpinion> minedOpinions; /** * Creates a {@link SentenceSentiment} model that describes the sentiment analysis of sentence. * @param text...
Redundant escape characters, seems like this should work? >final String patternRegex = "#/documents/(\\d+)/sentences/(\\d+)/opinions/(\\d+)";
int[] parseRefPointerToIndexArray(String opinionPointer) { final String patternRegex = " final Pattern pattern = Pattern.compile(patternRegex); final Matcher matcher = pattern.matcher(opinionPointer); final boolean isMatched = matcher.find(); final int[] result = new int[3]; if (isMatched) { String[] segments = opinion...
final String patternRegex = "
int[] parseRefPointerToIndexArray(String opinionPointer) { final String patternRegex = " final Pattern pattern = Pattern.compile(patternRegex); final Matcher matcher = pattern.matcher(opinionPointer); final boolean isMatched = matcher.find(); final int[] result = new int[3]; if (isMatched) { String[] segments = opinion...
class AnalyzeSentimentAsyncClient { private static final int NEUTRAL_SCORE_ZERO = 0; private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link AnalyzeSentimentAsyncClient} that sends requests to the Text Analytics servi...
class AnalyzeSentimentAsyncClient { private static final int NEUTRAL_SCORE_ZERO = 0; private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); private final TextAnalyticsClientImpl service; /** * Create an {@link AnalyzeSentimentAsyncClient} that sends requests to the Text Analytics servi...
Sorry to keep asking this, but it looks like we decided to allow null for options when they don't have a required value?
Mono<Response<Void>> sealWithResponse(AppendBlobSealOptions options, Context context) { options = (options == null) ? new AppendBlobSealOptions() : options; AppendBlobRequestConditions requestConditions = options.getRequestConditions(); requestConditions = (requestConditions == null) ? new AppendBlobRequestConditions()...
options = (options == null) ? new AppendBlobSealOptions() : options;
new AppendBlobSealOptions()) .flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); }
class AppendBlobAsyncClient extends BlobAsyncClientBase { private final ClientLogger logger = new ClientLogger(AppendBlobAsyncClient.class); /** * Indicates the maximum number of bytes that can be sent in a call to appendBlock. */ public static final int MAX_APPEND_BLOCK_BYTES = 4 * Constants.MB; /** * Indicates the ma...
class AppendBlobAsyncClient extends BlobAsyncClientBase { private final ClientLogger logger = new ClientLogger(AppendBlobAsyncClient.class); /** * Indicates the maximum number of bytes that can be sent in a call to appendBlock. */ public static final int MAX_APPEND_BLOCK_BYTES = 4 * Constants.MB; /** * Indicates the ma...
yeah I noticed that we do allow null for options when they dont have a required value. Im gonna create a PR after this making them all have this functionality - just didnt want to have this PR do 2 things at once
Mono<Response<Void>> sealWithResponse(AppendBlobSealOptions options, Context context) { options = (options == null) ? new AppendBlobSealOptions() : options; AppendBlobRequestConditions requestConditions = options.getRequestConditions(); requestConditions = (requestConditions == null) ? new AppendBlobRequestConditions()...
options = (options == null) ? new AppendBlobSealOptions() : options;
new AppendBlobSealOptions()) .flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); }
class AppendBlobAsyncClient extends BlobAsyncClientBase { private final ClientLogger logger = new ClientLogger(AppendBlobAsyncClient.class); /** * Indicates the maximum number of bytes that can be sent in a call to appendBlock. */ public static final int MAX_APPEND_BLOCK_BYTES = 4 * Constants.MB; /** * Indicates the ma...
class AppendBlobAsyncClient extends BlobAsyncClientBase { private final ClientLogger logger = new ClientLogger(AppendBlobAsyncClient.class); /** * Indicates the maximum number of bytes that can be sent in a call to appendBlock. */ public static final int MAX_APPEND_BLOCK_BYTES = 4 * Constants.MB; /** * Indicates the ma...
https://github.com/Azure/azure-sdk-for-java/pull/13339/
Mono<Response<Void>> sealWithResponse(AppendBlobSealOptions options, Context context) { options = (options == null) ? new AppendBlobSealOptions() : options; AppendBlobRequestConditions requestConditions = options.getRequestConditions(); requestConditions = (requestConditions == null) ? new AppendBlobRequestConditions()...
options = (options == null) ? new AppendBlobSealOptions() : options;
new AppendBlobSealOptions()) .flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); }
class AppendBlobAsyncClient extends BlobAsyncClientBase { private final ClientLogger logger = new ClientLogger(AppendBlobAsyncClient.class); /** * Indicates the maximum number of bytes that can be sent in a call to appendBlock. */ public static final int MAX_APPEND_BLOCK_BYTES = 4 * Constants.MB; /** * Indicates the ma...
class AppendBlobAsyncClient extends BlobAsyncClientBase { private final ClientLogger logger = new ClientLogger(AppendBlobAsyncClient.class); /** * Indicates the maximum number of bytes that can be sent in a call to appendBlock. */ public static final int MAX_APPEND_BLOCK_BYTES = 4 * Constants.MB; /** * Indicates the ma...
Do the level needs to be higher like at-least WARN?
public Mono<ShouldRetryResult> shouldRetry(Exception exception) { Duration backoffTime; Duration timeout; if (!(exception instanceof RetryWithException)) { logger.debug("Operation will NOT be retried. Current attempt {}, Exception: ", this.attemptCount, exception); return Mono.just(ShouldRetryResult.noRetry()); } Retry...
logger.debug("Received retrywith exception after backoff/retry. Will fail the request.",
public Mono<ShouldRetryResult> shouldRetry(Exception exception) { return this.retryWithRetryPolicy.shouldRetry(exception) .flatMap((retryWithResult) -> { if (retryWithResult.shouldRetry) { return Mono.just(retryWithResult); } return this.goneRetryPolicy.shouldRetry(exception) .flatMap((goneRetryResult) -> { if (!goneRe...
class GoneAndRetryWithRetryPolicy extends RetryPolicyWithDiagnostics { private final static Logger logger = LoggerFactory.getLogger(GoneAndRetryWithRetryPolicy.class); private final GoneRetryPolicy goneRetryPolicy; private final RetryWithRetryPolicy retryWithRetryPolicy; private final StopWatch durationTimer = new Stop...
class GoneAndRetryWithRetryPolicy extends RetryPolicyWithDiagnostics{ private final static Logger logger = LoggerFactory.getLogger(GoneAndRetryWithRetryPolicy.class); private final GoneRetryPolicy goneRetryPolicy; private final RetryWithRetryPolicy retryWithRetryPolicy; private final Instant start; private volatile Ins...
I think this statement is the same as ReceiveAndDeleteMessageTest.class?
public static void main(String[] args) { Class<?>[] testClasses; try { testClasses = new Class<?>[]{ Class.forName(ReceiveAndDeleteMessageTest.class.getName()), Class.forName(ReceiveAndLockMessageTest.class.getName()), Class.forName(SendMessageTest.class.getName()), Class.forName(SendMessagesTest.class.getName()) }; } ...
Class.forName(ReceiveAndDeleteMessageTest.class.getName()),
public static void main(String[] args) { Class<?>[] testClasses; testClasses = new Class<?>[]{ ReceiveAndDeleteMessageTest.class, ReceiveAndLockMessageTest.class, SendMessageTest.class, SendMessagesTest.class }; PerfStressProgram.run(testClasses, args); }
class App { /** * main function. * @param args args * @throws RuntimeException If not able to load test classes. */ }
class App { /** * main function. * @param args args * @throws RuntimeException If not able to load test classes. */ }
@g2vinay can we update the guides and all uses of this just to use `.class`? ```java PerfStressProgram.run(new Class<?>[] { ReceiveAndDeleteMessageTest.class, ReceiveAndLockMessageTest.class, SendMessageTest.class, SendMessagesTest.class }, args); ``` There should be no need to get the `Class` by name as it i...
public static void main(String[] args) { Class<?>[] testClasses; try { testClasses = new Class<?>[]{ Class.forName(ReceiveAndDeleteMessageTest.class.getName()), Class.forName(ReceiveAndLockMessageTest.class.getName()), Class.forName(SendMessageTest.class.getName()), Class.forName(SendMessagesTest.class.getName()) }; } ...
};
public static void main(String[] args) { Class<?>[] testClasses; testClasses = new Class<?>[]{ ReceiveAndDeleteMessageTest.class, ReceiveAndLockMessageTest.class, SendMessageTest.class, SendMessagesTest.class }; PerfStressProgram.run(testClasses, args); }
class App { /** * main function. * @param args args * @throws RuntimeException If not able to load test classes. */ }
class App { /** * main function. * @param args args * @throws RuntimeException If not able to load test classes. */ }
I think so. I happened to have the same comment 4 lines above.
public static void main(String[] args) { Class<?>[] testClasses; try { testClasses = new Class<?>[]{ Class.forName(ReceiveAndDeleteMessageTest.class.getName()), Class.forName(ReceiveAndLockMessageTest.class.getName()), Class.forName(SendMessageTest.class.getName()), Class.forName(SendMessagesTest.class.getName()) }; } ...
};
public static void main(String[] args) { Class<?>[] testClasses; testClasses = new Class<?>[]{ ReceiveAndDeleteMessageTest.class, ReceiveAndLockMessageTest.class, SendMessageTest.class, SendMessagesTest.class }; PerfStressProgram.run(testClasses, args); }
class App { /** * main function. * @param args args * @throws RuntimeException If not able to load test classes. */ }
class App { /** * main function. * @param args args * @throws RuntimeException If not able to load test classes. */ }
@srnagar @JonathanGiles Confirming if this ^^ is how we would be using the `FormField<T>` for strongly typed examples? Since we don't have any `T` value, still would need to extract the corresponding `asString`, or `asX` methods.
public static void main(final String[] args) { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); String receiptUrl = "https: + "/azure-ai-formrecognizer/src/samples/java/sample-forms/receipts/contoso-allinone.jpg"; SyncPoller<O...
public static void main(final String[] args) { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); String receiptUrl = "https: + "/azure-ai-formrecognizer/src/samples/java/sample-forms/receipts/contoso-allinone.jpg"; SyncPoller<O...
class StronglyTypedRecognizedForm { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
class StronglyTypedRecognizedForm { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
assertTrue(inputMap.equals(actualList)); https://www.baeldung.com/java-compare-hashmaps
public void toMapFromMap() { Map<String, FormField<?>> inputMap = new HashMap<String, FormField<?>>() { { put("key", new FormField<>(null, null, null, null, 0)); } }; Map<String, FormField<?>> actualList = new FormField<>(null, null, null, new FieldValue(FieldValueType.MAP).setFormFieldMap(inputMap), 0).getValue().asMa...
assertEquals(inputMap, actualList);
public void toMapFromMap() { Map<String, FormField> inputMap = new HashMap<String, FormField>() { { put("key", new FormField(null, null, null, null, 0)); } }; Map<String, FormField> actualMap = new FormField(null, null, null, new FieldValue(inputMap, FieldValueType.MAP), 0).getValue().asMap(); assertEquals(inputMap, ac...
class FieldValueExtensionMethodTest { /** * Test for {@link FieldValue */ @Test public void toDateFromDate() { LocalDate inputDate = LocalDate.of(2006, 6, 6); FormField<?> formField = new FormField<>(null, null, null, new FieldValue(FieldValueType.DATE) .setFormFieldDate(inputDate), 0); LocalDate actualDate = formField...
class FieldValueExtensionMethodTest { /** * Test for {@link FieldValue */ @Test public void toDateFromDate() { LocalDate inputDate = LocalDate.of(2006, 6, 6); FormField formField = new FormField(null, null, null, new FieldValue(inputDate, FieldValueType.DATE), 0); LocalDate actualDate = formField.getValue().asDate(); a...
I don't think the generic type `<T>` is useful if the user still has to do `getFieldValue().asString()`. I think we are trying to make `FormField` work both ways and is causing this issue. Have you considered the approach below? It's not ideal but a new type that's defined once can reduce the burden on the user. The...
public static void main(final String[] args) { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); String receiptUrl = "https: + "/azure-ai-formrecognizer/src/samples/java/sample-forms/receipts/contoso-allinone.jpg"; SyncPoller<O...
public static void main(final String[] args) { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildClient(); String receiptUrl = "https: + "/azure-ai-formrecognizer/src/samples/java/sample-forms/receipts/contoso-allinone.jpg"; SyncPoller<O...
class StronglyTypedRecognizedForm { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
class StronglyTypedRecognizedForm { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
expectNextCount = 2
public void testDeleteAll() { Flux<LongIdDomainPartition> savedAllFlux = this.repository.saveAll(Arrays.asList(DOMAIN_1, DOMAIN_2)); StepVerifier.create(savedAllFlux).thenConsumeWhile(domain -> true).expectComplete().verify(); final Mono<Void> deletedMono = repository.deleteAll(); StepVerifier.create(deletedMono).thenA...
StepVerifier.create(savedAllFlux).thenConsumeWhile(domain -> true).expectComplete().verify();
public void testDeleteAll() { Flux<LongIdDomainPartition> savedAllFlux = this.repository.saveAll(Arrays.asList(DOMAIN_1, DOMAIN_2)); StepVerifier.create(savedAllFlux).expectNextCount(2).verifyComplete(); final Mono<Void> deletedMono = repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete()...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
Setup can be done on a blocking call - need not to worry about it, but this looks good, thanks :)
public void setUp() { if (!isSetupDone) { staticTemplate = template; template.createContainerIfNotExists(entityInformation); } Flux<LongIdDomainPartition> savedAllFlux = this.repository.saveAll(Arrays.asList(DOMAIN_1, DOMAIN_2)); StepVerifier.create(savedAllFlux).thenConsumeWhile(domain -> true).expectComplete().verify...
StepVerifier.create(savedAllFlux).thenConsumeWhile(domain -> true).expectComplete().verify();
public void setUp() { if (!isSetupDone) { staticTemplate = template; template.createContainerIfNotExists(entityInformation); } Flux<LongIdDomainPartition> savedAllFlux = this.repository.saveAll(Arrays.asList(DOMAIN_1, DOMAIN_2)); StepVerifier.create(savedAllFlux).thenConsumeWhile(domain -> true).expectComplete().verify...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
Here, we should test that the response is the saved `DOMAIN_1` something like this -> ```suggestion StepVerifier.create(findIdMono).expectNext(DOMAIN_1).expectComplete().verify(); ```
public void testLongIdDomainPartition() { Mono<Void> deletedMono = this.repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Mono<LongIdDomainPartition> idMono = this.repository.findById(ID_1, new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create...
StepVerifier.create(saveMono).thenConsumeWhile(domain -> true).expectComplete().verify();
public void testLongIdDomainPartition() { Mono<Void> deletedMono = this.repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Mono<LongIdDomainPartition> idMono = this.repository.findById(ID_1, new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
Here, we can make sure that nothing is returned from the backend - since we deleted all entities. ```suggestion StepVerifier.create(idMono).expectNextCount(0).verifyComplete(); ```
public void testLongIdDomainPartition() { Mono<Void> deletedMono = this.repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Mono<LongIdDomainPartition> idMono = this.repository.findById(ID_1, new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create...
StepVerifier.create(idMono).verifyComplete();
public void testLongIdDomainPartition() { Mono<Void> deletedMono = this.repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Mono<LongIdDomainPartition> idMono = this.repository.findById(ID_1, new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
Same here, we can make sure that entities are not returned back. ```suggestion StepVerifier.create(afterDelIdMono).expectNextCount(0).verifyComplete(); ```
public void testLongIdDomainPartition() { Mono<Void> deletedMono = this.repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Mono<LongIdDomainPartition> idMono = this.repository.findById(ID_1, new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create...
StepVerifier.create(afterDelIdMono).verifyComplete();
public void testLongIdDomainPartition() { Mono<Void> deletedMono = this.repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Mono<LongIdDomainPartition> idMono = this.repository.findById(ID_1, new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
We can verify the count here as well, like you have done below.
public void testSaveAllAndFindAll() { final Mono<Void> deletedMono = repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Flux<LongIdDomainPartition> savedAllFlux = this.repository.saveAll(Arrays.asList(DOMAIN_1, DOMAIN_2)); StepVerifier.create(savedAllFlux).thenConsumeWhile(domain -> ...
StepVerifier.create(savedAllFlux).thenConsumeWhile(domain -> true).expectComplete().verify();
public void testSaveAllAndFindAll() { final Mono<Void> deletedMono = repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Flux<LongIdDomainPartition> savedAllFlux = this.repository.saveAll(Arrays.asList(DOMAIN_1, DOMAIN_2)); StepVerifier.create(savedAllFlux).expectNextCount(2).verifyCo...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
Same here, make sure the expectNextCount = 0
public void testDeleteByIdAndPartitionKey() { final Mono<Void> deleteMono = repository.deleteById(DOMAIN_1.getNumber(), new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create(deleteMono).verifyComplete(); Mono<LongIdDomainPartition> findIdMono = this.repository.findById(ID_1, new ...
StepVerifier.create(findIdMono).verifyComplete();
public void testDeleteByIdAndPartitionKey() { final Mono<Void> deleteMono = repository.deleteById(DOMAIN_1.getNumber(), new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create(deleteMono).verifyComplete(); Mono<LongIdDomainPartition> findIdMono = this.repository.findById(ID_1, new ...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
`expectNext = DOMAIN_1`
public void testDelete() { Mono<LongIdDomainPartition> saveMono = this.repository.save(DOMAIN_1); StepVerifier.create(saveMono).thenConsumeWhile(domain -> true).expectComplete().verify(); Mono<Void> deleteMono = this.repository.delete(DOMAIN_1); StepVerifier.create(deleteMono).verifyComplete(); Mono<Long> countMono = r...
StepVerifier.create(saveMono).thenConsumeWhile(domain -> true).expectComplete().verify();
public void testDelete() { Mono<LongIdDomainPartition> saveMono = this.repository.save(DOMAIN_1); StepVerifier.create(saveMono).expectNext(DOMAIN_1).expectComplete().verify(); Mono<Void> deleteMono = this.repository.delete(DOMAIN_1); StepVerifier.create(deleteMono).verifyComplete(); Mono<Long> countMono = repository.co...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
class ReactiveLongIdDomainPartitionPartitionRepositoryIT { private static final Long ID_1 = 12345L; private static final String NAME_1 = "moary"; private static final Long ID_2 = 67890L; private static final String NAME_2 = "camille"; private static final LongIdDomainPartition DOMAIN_1 = new LongIdDomainPartition(ID_1,...
remember to run `credcheck` for storage key
private Flux<VolumeParameters> createFileShareAsync(final StorageAccount storageAccount) { return storageAccount .getKeysAsync() .map(storageAccountKeys -> storageAccountKeys.get(0).value()) .flatMapMany( key -> { ShareServiceAsyncClient shareServiceAsyncClient = new ShareServiceClientBuilder() .connectionString( Utils...
.map(storageAccountKeys -> storageAccountKeys.get(0).value())
private Flux<VolumeParameters> createFileShareAsync(final StorageAccount storageAccount) { return storageAccount .getKeysAsync() .map(storageAccountKeys -> storageAccountKeys.get(0).value()) .flatMapMany( key -> { ShareServiceAsyncClient shareServiceAsyncClient = new ShareServiceClientBuilder() .connectionString( Utils...
class VolumeParameters { private String volumeName; private String fileShareName; private String storageAccountKey; VolumeParameters(String volumeName, String fileShareName, String storageAccountKey) { this.volumeName = volumeName; this.fileShareName = fileShareName; this.storageAccountKey = storageAccountKey; } }
class VolumeParameters { private String volumeName; private String fileShareName; private String storageAccountKey; VolumeParameters(String volumeName, String fileShareName, String storageAccountKey) { this.volumeName = volumeName; this.fileShareName = fileShareName; this.storageAccountKey = storageAccountKey; } }
All playback tests are not using the `Share File Volume`, so no keys are recorded.
private Flux<VolumeParameters> createFileShareAsync(final StorageAccount storageAccount) { return storageAccount .getKeysAsync() .map(storageAccountKeys -> storageAccountKeys.get(0).value()) .flatMapMany( key -> { ShareServiceAsyncClient shareServiceAsyncClient = new ShareServiceClientBuilder() .connectionString( Utils...
.map(storageAccountKeys -> storageAccountKeys.get(0).value())
private Flux<VolumeParameters> createFileShareAsync(final StorageAccount storageAccount) { return storageAccount .getKeysAsync() .map(storageAccountKeys -> storageAccountKeys.get(0).value()) .flatMapMany( key -> { ShareServiceAsyncClient shareServiceAsyncClient = new ShareServiceClientBuilder() .connectionString( Utils...
class VolumeParameters { private String volumeName; private String fileShareName; private String storageAccountKey; VolumeParameters(String volumeName, String fileShareName, String storageAccountKey) { this.volumeName = volumeName; this.fileShareName = fileShareName; this.storageAccountKey = storageAccountKey; } }
class VolumeParameters { private String volumeName; private String fileShareName; private String storageAccountKey; VolumeParameters(String volumeName, String fileShareName, String storageAccountKey) { this.volumeName = volumeName; this.fileShareName = fileShareName; this.storageAccountKey = storageAccountKey; } }
this is test and it doesn't matter much. but in general you should not create a ObjectMapper per method invocation, This is costly timewise.
private void validateJson(String jsonInString) { try { ObjectMapper mapper = new ObjectMapper(); mapper.readTree(jsonInString); } catch(JsonProcessingException ex) { fail("Diagnostic string is not in json format"); } }
ObjectMapper mapper = new ObjectMapper();
private void validateJson(String jsonInString) { try { OBJECT_MAPPER.readTree(jsonInString); } catch(JsonProcessingException ex) { fail("Diagnostic string is not in json format"); } }
class CosmosDiagnosticsTest extends TestSuiteBase { private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; private CosmosClientBuilder cosmosClientBuilder; @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) p...
class CosmosDiagnosticsTest extends TestSuiteBase { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"simple"}, timeOut...
Yes good catch, although its test, but it should be on class level , i will change it in next iteration
private void validateJson(String jsonInString) { try { ObjectMapper mapper = new ObjectMapper(); mapper.readTree(jsonInString); } catch(JsonProcessingException ex) { fail("Diagnostic string is not in json format"); } }
ObjectMapper mapper = new ObjectMapper();
private void validateJson(String jsonInString) { try { OBJECT_MAPPER.readTree(jsonInString); } catch(JsonProcessingException ex) { fail("Diagnostic string is not in json format"); } }
class CosmosDiagnosticsTest extends TestSuiteBase { private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; private CosmosClientBuilder cosmosClientBuilder; @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) p...
class CosmosDiagnosticsTest extends TestSuiteBase { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"simple"}, timeOut...
We can make this inline. ```suggestion return ";" + USER_AGENT_SUFFIX; ```
private static String getUserAgentSuffix() { String suffix = ";" + USER_AGENT_SUFFIX; return suffix; }
return suffix;
private static String getUserAgentSuffix() { return ";" + USER_AGENT_SUFFIX; }
class CosmosFactory { private static final Logger LOGGER = LoggerFactory.getLogger(CosmosFactory.class); private final CosmosAsyncClient cosmosAsyncClient; private final String databaseName; private static final String USER_AGENT_SUFFIX = Constants.USER_AGENT_SUFFIX + PropertyLoader.getProjectVersion(); /** * Validate ...
class CosmosFactory { private static final Logger LOGGER = LoggerFactory.getLogger(CosmosFactory.class); private final CosmosAsyncClient cosmosAsyncClient; private final String databaseName; private static final String USER_AGENT_SUFFIX = Constants.USER_AGENT_SUFFIX + PropertyLoader.getProjectVersion(); /** * Validate ...
👍
private static String getPropertyByName(@NonNull String name, @NonNull String filename) { final Properties properties = new Properties(); final InputStream inputStream = PropertyLoader.class.getResourceAsStream(filename); if (inputStream == null) { return null; } try { properties.load(inputStream); } catch (IOException...
final InputStream inputStream = PropertyLoader.class.getResourceAsStream(filename);
private static String getPropertyByName(@NonNull String name, @NonNull String filename) { final Properties properties = new Properties(); final InputStream inputStream = PropertyLoader.class.getResourceAsStream(filename); if (inputStream == null) { return null; } try { properties.load(inputStream); } catch (IOException...
class PropertyLoader { private static final String PROJECT_PROPERTY_FILE = "/META-INF/project.properties"; private static final String APPLICATION_PROPERTY_FILE = "/application.properties"; private static final String APPLICATION_YML_FILE = "/application.yml"; private PropertyLoader() { } /** * Get project version from...
class PropertyLoader { private static final String PROJECT_PROPERTY_FILE = "/META-INF/project.properties"; private static final String APPLICATION_PROPERTY_FILE = "/application.properties"; private static final String APPLICATION_YML_FILE = "/application.yml"; private PropertyLoader() { } /** * Get project version from...
this class is getting instantiated in a for loop in your benchmark, meaning the logger initialization will be called per for loop iteration. logger should be static to avoid initialization cost per loop iteration.
public BenchmarkRequestSubscriber(Meter successMeter, Meter failureMeter, Semaphore concurrencyControlSemaphore, AtomicLong count) { this.successMeter = successMeter; this.failureMeter = failureMeter; this.concurrencyControlSemaphore = concurrencyControlSemaphore; this.count = count; logger = LoggerFactory.getLogger(t...
logger = LoggerFactory.getLogger(this.getClass());
public BenchmarkRequestSubscriber(Meter successMeter, Meter failureMeter, Semaphore concurrencyControlSemaphore, AtomicLong count) { this.successMeter = successMeter; this.failureMeter = failureMeter; this.concurrencyControlSemaphore = concurrencyControlSemaphore; this.count = count; }
class BenchmarkRequestSubscriber<T> extends BaseSubscriber<T> { final Logger logger; private Meter successMeter; private Meter failureMeter; private Semaphore concurrencyControlSemaphore; private AtomicLong count; Timer.Context context; @Override protected void hookOnSubscribe(Subscription subscription) { super.hookOn...
class BenchmarkRequestSubscriber<T> extends BaseSubscriber<T> { final static Logger logger = LoggerFactory.getLogger(BenchmarkRequestSubscriber.class); private Meter successMeter; private Meter failureMeter; private Semaphore concurrencyControlSemaphore; private AtomicLong count; public Timer.Context context; @Override...
done
public BenchmarkRequestSubscriber(Meter successMeter, Meter failureMeter, Semaphore concurrencyControlSemaphore, AtomicLong count) { this.successMeter = successMeter; this.failureMeter = failureMeter; this.concurrencyControlSemaphore = concurrencyControlSemaphore; this.count = count; logger = LoggerFactory.getLogger(t...
logger = LoggerFactory.getLogger(this.getClass());
public BenchmarkRequestSubscriber(Meter successMeter, Meter failureMeter, Semaphore concurrencyControlSemaphore, AtomicLong count) { this.successMeter = successMeter; this.failureMeter = failureMeter; this.concurrencyControlSemaphore = concurrencyControlSemaphore; this.count = count; }
class BenchmarkRequestSubscriber<T> extends BaseSubscriber<T> { final Logger logger; private Meter successMeter; private Meter failureMeter; private Semaphore concurrencyControlSemaphore; private AtomicLong count; Timer.Context context; @Override protected void hookOnSubscribe(Subscription subscription) { super.hookOn...
class BenchmarkRequestSubscriber<T> extends BaseSubscriber<T> { final static Logger logger = LoggerFactory.getLogger(BenchmarkRequestSubscriber.class); private Meter successMeter; private Meter failureMeter; private Semaphore concurrencyControlSemaphore; private AtomicLong count; public Timer.Context context; @Override...
as a code style, we should try to either 1. have all args on the same line 2. or if there are many, have one arg per line. Please try to follow that here and in other new code.
public void run() throws Exception { readSuccessMeter = metricsRegistry.meter(" readFailureMeter = metricsRegistry.meter(" writeSuccessMeter = metricsRegistry.meter(" writeFailureMeter = metricsRegistry.meter(" querySuccessMeter = metricsRegistry.meter(" queryFailureMeter = metricsRegistry.meter(" readLatency = metrics...
readFailureMeter, concurrencyControlSemaphore, count);
public void run() throws Exception { readSuccessMeter = metricsRegistry.meter(" readFailureMeter = metricsRegistry.meter(" writeSuccessMeter = metricsRegistry.meter(" writeFailureMeter = metricsRegistry.meter(" querySuccessMeter = metricsRegistry.meter(" queryFailureMeter = metricsRegistry.meter(" readLatency = metrics...
class AsyncCtlWorkload { private final String PERCENT_PARSING_ERROR = "Unable to parse user provided readWriteQueryPct, using default {} {} {}"; private final String prefixUuidForCreate; private final String dataFieldValue; private final String partitionKey; private final MetricRegistry metricsRegistry = new MetricRegi...
class AsyncCtlWorkload { private final String PERCENT_PARSING_ERROR = "Unable to parse user provided readWriteQueryPct "; private final String prefixUuidForCreate; private final String dataFieldValue; private final String partitionKey; private final MetricRegistry metricsRegistry = new MetricRegistry(); private final L...
if the input config is not valid, shouldn't we log error and terminate? otherwise invalid config may go unnoticed. I don't see you throwing any exception on invalid config.
private void parsedReadWriteQueryPct(String readWriteQueryPct) { String[] readWriteQueryPctList = readWriteQueryPct.split(","); if (readWriteQueryPctList.length == 3) { try { if (Integer.valueOf(readWriteQueryPctList[0]) + Integer.valueOf(readWriteQueryPctList[1]) + Integer.valueOf(readWriteQueryPctList[2]) == 100) { r...
}
private void parsedReadWriteQueryPct(String readWriteQueryPct) { String[] readWriteQueryPctList = readWriteQueryPct.split(","); if (readWriteQueryPctList.length == 3) { try { if (Integer.valueOf(readWriteQueryPctList[0]) + Integer.valueOf(readWriteQueryPctList[1]) + Integer.valueOf(readWriteQueryPctList[2]) == 100) { r...
class AsyncCtlWorkload { private final String PERCENT_PARSING_ERROR = "Unable to parse user provided readWriteQueryPct, using default {} {} {}"; private final String prefixUuidForCreate; private final String dataFieldValue; private final String partitionKey; private final MetricRegistry metricsRegistry = new MetricRegi...
class AsyncCtlWorkload { private final String PERCENT_PARSING_ERROR = "Unable to parse user provided readWriteQueryPct "; private final String prefixUuidForCreate; private final String dataFieldValue; private final String partitionKey; private final MetricRegistry metricsRegistry = new MetricRegistry(); private final L...
so on query, we just run an orderby by query and we expect it to not fail, but we don't validate the result. am I right?
private void performWorkload(BaseSubscriber<Object> documentSubscriber, OperationType type, long i) throws Exception { Flux<? extends Object> obs; CosmosAsyncContainer container = containers.get((int) i % containers.size()); if (type.equals(OperationType.Create)) { PojoizedJson data = BenchmarkHelper.generateDocument(p...
obs = container.queryItems(sqlQuery, options, PojoizedJson.class).byPage(10);
private void performWorkload(BaseSubscriber<Object> documentSubscriber, OperationType type, long i) throws Exception { Flux<? extends Object> obs; CosmosAsyncContainer container = containers.get((int) i % containers.size()); if (type.equals(OperationType.Create)) { PojoizedJson data = BenchmarkHelper.generateDocument(p...
class AsyncCtlWorkload { private final String PERCENT_PARSING_ERROR = "Unable to parse user provided readWriteQueryPct, using default {} {} {}"; private final String prefixUuidForCreate; private final String dataFieldValue; private final String partitionKey; private final MetricRegistry metricsRegistry = new MetricRegi...
class AsyncCtlWorkload { private final String PERCENT_PARSING_ERROR = "Unable to parse user provided readWriteQueryPct "; private final String prefixUuidForCreate; private final String dataFieldValue; private final String partitionKey; private final MetricRegistry metricsRegistry = new MetricRegistry(); private final L...
Yes i was printing warning and using default, but throwing exception would be more clear. Done
private void parsedReadWriteQueryPct(String readWriteQueryPct) { String[] readWriteQueryPctList = readWriteQueryPct.split(","); if (readWriteQueryPctList.length == 3) { try { if (Integer.valueOf(readWriteQueryPctList[0]) + Integer.valueOf(readWriteQueryPctList[1]) + Integer.valueOf(readWriteQueryPctList[2]) == 100) { r...
}
private void parsedReadWriteQueryPct(String readWriteQueryPct) { String[] readWriteQueryPctList = readWriteQueryPct.split(","); if (readWriteQueryPctList.length == 3) { try { if (Integer.valueOf(readWriteQueryPctList[0]) + Integer.valueOf(readWriteQueryPctList[1]) + Integer.valueOf(readWriteQueryPctList[2]) == 100) { r...
class AsyncCtlWorkload { private final String PERCENT_PARSING_ERROR = "Unable to parse user provided readWriteQueryPct, using default {} {} {}"; private final String prefixUuidForCreate; private final String dataFieldValue; private final String partitionKey; private final MetricRegistry metricsRegistry = new MetricRegi...
class AsyncCtlWorkload { private final String PERCENT_PARSING_ERROR = "Unable to parse user provided readWriteQueryPct "; private final String prefixUuidForCreate; private final String dataFieldValue; private final String partitionKey; private final MetricRegistry metricsRegistry = new MetricRegistry(); private final L...
Yes we are not validating result , as it would put extra perf to our sdk query end to end result. We are only expecting it not to fail for a successful result.
private void performWorkload(BaseSubscriber<Object> documentSubscriber, OperationType type, long i) throws Exception { Flux<? extends Object> obs; CosmosAsyncContainer container = containers.get((int) i % containers.size()); if (type.equals(OperationType.Create)) { PojoizedJson data = BenchmarkHelper.generateDocument(p...
obs = container.queryItems(sqlQuery, options, PojoizedJson.class).byPage(10);
private void performWorkload(BaseSubscriber<Object> documentSubscriber, OperationType type, long i) throws Exception { Flux<? extends Object> obs; CosmosAsyncContainer container = containers.get((int) i % containers.size()); if (type.equals(OperationType.Create)) { PojoizedJson data = BenchmarkHelper.generateDocument(p...
class AsyncCtlWorkload { private final String PERCENT_PARSING_ERROR = "Unable to parse user provided readWriteQueryPct, using default {} {} {}"; private final String prefixUuidForCreate; private final String dataFieldValue; private final String partitionKey; private final MetricRegistry metricsRegistry = new MetricRegi...
class AsyncCtlWorkload { private final String PERCENT_PARSING_ERROR = "Unable to parse user provided readWriteQueryPct "; private final String prefixUuidForCreate; private final String dataFieldValue; private final String partitionKey; private final MetricRegistry metricsRegistry = new MetricRegistry(); private final L...
done
public void run() throws Exception { readSuccessMeter = metricsRegistry.meter(" readFailureMeter = metricsRegistry.meter(" writeSuccessMeter = metricsRegistry.meter(" writeFailureMeter = metricsRegistry.meter(" querySuccessMeter = metricsRegistry.meter(" queryFailureMeter = metricsRegistry.meter(" readLatency = metrics...
readFailureMeter, concurrencyControlSemaphore, count);
public void run() throws Exception { readSuccessMeter = metricsRegistry.meter(" readFailureMeter = metricsRegistry.meter(" writeSuccessMeter = metricsRegistry.meter(" writeFailureMeter = metricsRegistry.meter(" querySuccessMeter = metricsRegistry.meter(" queryFailureMeter = metricsRegistry.meter(" readLatency = metrics...
class AsyncCtlWorkload { private final String PERCENT_PARSING_ERROR = "Unable to parse user provided readWriteQueryPct, using default {} {} {}"; private final String prefixUuidForCreate; private final String dataFieldValue; private final String partitionKey; private final MetricRegistry metricsRegistry = new MetricRegi...
class AsyncCtlWorkload { private final String PERCENT_PARSING_ERROR = "Unable to parse user provided readWriteQueryPct "; private final String prefixUuidForCreate; private final String dataFieldValue; private final String partitionKey; private final MetricRegistry metricsRegistry = new MetricRegistry(); private final L...
we have different `queryDatabase` API and all are calling one. You don't need to repeat this on every different form. you could just add this to `queryDatabaseInternal()`
public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options) { if (options == null) { options = new CosmosQueryRequestOptions(); } return queryDatabasesInternal(querySpec, options); }
return queryDatabasesInternal(querySpec, options);
public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options) { if (options == null) { options = new CosmosQueryRequestOptions(); } return queryDatabasesInternal(querySpec, options); }
class CosmosAsyncClient implements Closeable { private final Configs configs; private final AsyncDocumentClient asyncDocumentClient; private final String serviceEndpoint; private final String keyOrResourceToken; private final ConnectionPolicy connectionPolicy; private final ConsistencyLevel desiredConsistencyLevel; pri...
class CosmosAsyncClient implements Closeable { private final Configs configs; private final AsyncDocumentClient asyncDocumentClient; private final String serviceEndpoint; private final String keyOrResourceToken; private final ConnectionPolicy connectionPolicy; private final ConsistencyLevel desiredConsistencyLevel; pri...
What you refer is the one without annotation on Method. However, if we do not have annoatation, we cannot guarantee what we pass is the getter method with 'get' prefix. I don't think we need to check too much things here as validating whether it is the invoked getter is a huge cost.
public void testPropertyNameOnMethodName() throws NoSuchMethodException { class Hotel { String hotelName; public String getHotelName() { return hotelName; } } Method m = Hotel.class.getDeclaredMethod("getHotelName"); assertMemberValue(m, "getHotelName"); }
assertMemberValue(m, "getHotelName");
public void testPropertyNameOnMethodName() throws NoSuchMethodException { class LocalHotel { String hotelName; public String getHotelName() { return hotelName; } } Method m = LocalHotel.class.getDeclaredMethod("getHotelName"); assertNull(serializer.convertMemberName(m)); }
class Hotel { @SerializedName(value = "") String hotelName; }
class LocalHotel { @SerializedName(value = "") String hotelName; }
I thought that too. We are following this explicit check on api entry point in crud operations. So one thing is consistency, second we have github item https://github.com/Azure/azure-sdk-for-java/issues/13031 , where we will refactor all apis in one work item, otherwise it will be confusing if we do it for some and le...
public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options) { if (options == null) { options = new CosmosQueryRequestOptions(); } return queryDatabasesInternal(querySpec, options); }
return queryDatabasesInternal(querySpec, options);
public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options) { if (options == null) { options = new CosmosQueryRequestOptions(); } return queryDatabasesInternal(querySpec, options); }
class CosmosAsyncClient implements Closeable { private final Configs configs; private final AsyncDocumentClient asyncDocumentClient; private final String serviceEndpoint; private final String keyOrResourceToken; private final ConnectionPolicy connectionPolicy; private final ConsistencyLevel desiredConsistencyLevel; pri...
class CosmosAsyncClient implements Closeable { private final Configs configs; private final AsyncDocumentClient asyncDocumentClient; private final String serviceEndpoint; private final String keyOrResourceToken; private final ConnectionPolicy connectionPolicy; private final ConsistencyLevel desiredConsistencyLevel; pri...
Can we avoid creating a new instance for same type here and also have a way to minimize duplicate instances when used by the user? Maybe have a static map of known types and vend those `TypeReference` instances if one exists or create one if it doesnt?
private static Stream<Arguments> deserializePrimitiveTypesSupplier() { return Stream.of( Arguments.of(streamCreator(0), schemaCreator("boolean"), new TypeReference<Boolean>() { }, false), Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true), Arguments.of(streamCreator(42), sc...
Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true),
private static Stream<Arguments> deserializePrimitiveTypesSupplier() { return Stream.of( Arguments.of(streamCreator(0), schemaCreator("boolean"), new TypeReference<Boolean>() { }, false), Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true), Arguments.of(streamCreator(42), sc...
class ApacheAvroSerializerTests { /* * This Avro schema specifies the Java string type that should be used to deserialize STRING. Without specifying * 'String' the default is 'CharSequence' which ends up being wrapped in Apache's 'Utf8' class. Additionally, this * can be set as a compile configuration. */ private stati...
class ApacheAvroSerializerTests { /* * This Avro schema specifies the Java string type that should be used to deserialize STRING. Without specifying * 'String' the default is 'CharSequence' which ends up being wrapped in Apache's 'Utf8' class. Additionally, this * can be set as a compile configuration. */ private stati...
Basically create a backing map of static references for common built-in Java types such as `Boolean`, `Integer`, `Map<String, Object>`, etc?
private static Stream<Arguments> deserializePrimitiveTypesSupplier() { return Stream.of( Arguments.of(streamCreator(0), schemaCreator("boolean"), new TypeReference<Boolean>() { }, false), Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true), Arguments.of(streamCreator(42), sc...
Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true),
private static Stream<Arguments> deserializePrimitiveTypesSupplier() { return Stream.of( Arguments.of(streamCreator(0), schemaCreator("boolean"), new TypeReference<Boolean>() { }, false), Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true), Arguments.of(streamCreator(42), sc...
class ApacheAvroSerializerTests { /* * This Avro schema specifies the Java string type that should be used to deserialize STRING. Without specifying * 'String' the default is 'CharSequence' which ends up being wrapped in Apache's 'Utf8' class. Additionally, this * can be set as a compile configuration. */ private stati...
class ApacheAvroSerializerTests { /* * This Avro schema specifies the Java string type that should be used to deserialize STRING. Without specifying * 'String' the default is 'CharSequence' which ends up being wrapped in Apache's 'Utf8' class. Additionally, this * can be set as a compile configuration. */ private stati...
Yeah, basically, support these built-in types out of the box and for custom types, lazily add to the backing map.
private static Stream<Arguments> deserializePrimitiveTypesSupplier() { return Stream.of( Arguments.of(streamCreator(0), schemaCreator("boolean"), new TypeReference<Boolean>() { }, false), Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true), Arguments.of(streamCreator(42), sc...
Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true),
private static Stream<Arguments> deserializePrimitiveTypesSupplier() { return Stream.of( Arguments.of(streamCreator(0), schemaCreator("boolean"), new TypeReference<Boolean>() { }, false), Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true), Arguments.of(streamCreator(42), sc...
class ApacheAvroSerializerTests { /* * This Avro schema specifies the Java string type that should be used to deserialize STRING. Without specifying * 'String' the default is 'CharSequence' which ends up being wrapped in Apache's 'Utf8' class. Additionally, this * can be set as a compile configuration. */ private stati...
class ApacheAvroSerializerTests { /* * This Avro schema specifies the Java string type that should be used to deserialize STRING. Without specifying * 'String' the default is 'CharSequence' which ends up being wrapped in Apache's 'Utf8' class. Additionally, this * can be set as a compile configuration. */ private stati...
The best I can think of would be an API such as this. ```java <T> TypeReference<T> createInstance(Class<T> clazz); ``` With a static cache of `Map<Class<T>, TypeReference<T>>`. This won't be able to handle `ParameterizedType`. Is this something we would need to GA this feature or could we add it later?
private static Stream<Arguments> deserializePrimitiveTypesSupplier() { return Stream.of( Arguments.of(streamCreator(0), schemaCreator("boolean"), new TypeReference<Boolean>() { }, false), Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true), Arguments.of(streamCreator(42), sc...
Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true),
private static Stream<Arguments> deserializePrimitiveTypesSupplier() { return Stream.of( Arguments.of(streamCreator(0), schemaCreator("boolean"), new TypeReference<Boolean>() { }, false), Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true), Arguments.of(streamCreator(42), sc...
class ApacheAvroSerializerTests { /* * This Avro schema specifies the Java string type that should be used to deserialize STRING. Without specifying * 'String' the default is 'CharSequence' which ends up being wrapped in Apache's 'Utf8' class. Additionally, this * can be set as a compile configuration. */ private stati...
class ApacheAvroSerializerTests { /* * This Avro schema specifies the Java string type that should be used to deserialize STRING. Without specifying * 'String' the default is 'CharSequence' which ends up being wrapped in Apache's 'Utf8' class. Additionally, this * can be set as a compile configuration. */ private stati...
Adding this after GA would lead to 2 different ways of creating an instance of `TypeReference` - ctor and static method. So, we have to finalize this before GA.
private static Stream<Arguments> deserializePrimitiveTypesSupplier() { return Stream.of( Arguments.of(streamCreator(0), schemaCreator("boolean"), new TypeReference<Boolean>() { }, false), Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true), Arguments.of(streamCreator(42), sc...
Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true),
private static Stream<Arguments> deserializePrimitiveTypesSupplier() { return Stream.of( Arguments.of(streamCreator(0), schemaCreator("boolean"), new TypeReference<Boolean>() { }, false), Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true), Arguments.of(streamCreator(42), sc...
class ApacheAvroSerializerTests { /* * This Avro schema specifies the Java string type that should be used to deserialize STRING. Without specifying * 'String' the default is 'CharSequence' which ends up being wrapped in Apache's 'Utf8' class. Additionally, this * can be set as a compile configuration. */ private stati...
class ApacheAvroSerializerTests { /* * This Avro schema specifies the Java string type that should be used to deserialize STRING. Without specifying * 'String' the default is 'CharSequence' which ends up being wrapped in Apache's 'Utf8' class. Additionally, this * can be set as a compile configuration. */ private stati...
I would stick with using constructor as this matches patterns used in other similar concepts.
private static Stream<Arguments> deserializePrimitiveTypesSupplier() { return Stream.of( Arguments.of(streamCreator(0), schemaCreator("boolean"), new TypeReference<Boolean>() { }, false), Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true), Arguments.of(streamCreator(42), sc...
Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true),
private static Stream<Arguments> deserializePrimitiveTypesSupplier() { return Stream.of( Arguments.of(streamCreator(0), schemaCreator("boolean"), new TypeReference<Boolean>() { }, false), Arguments.of(streamCreator(1), schemaCreator("boolean"), new TypeReference<Boolean>() { }, true), Arguments.of(streamCreator(42), sc...
class ApacheAvroSerializerTests { /* * This Avro schema specifies the Java string type that should be used to deserialize STRING. Without specifying * 'String' the default is 'CharSequence' which ends up being wrapped in Apache's 'Utf8' class. Additionally, this * can be set as a compile configuration. */ private stati...
class ApacheAvroSerializerTests { /* * This Avro schema specifies the Java string type that should be used to deserialize STRING. Without specifying * 'String' the default is 'CharSequence' which ends up being wrapped in Apache's 'Utf8' class. Additionally, this * can be set as a compile configuration. */ private stati...
Do we need mayHaveBody check , what happen if we clear on all cancel irrespective of body, we can avoid extra check ?
private void releaseAfterCancel(HttpMethod method) { if (mayHaveBody(method) && this.state.compareAndSet(ReactorNettyResponseState.NOT_SUBSCRIBED, ReactorNettyResponseState.CANCELLED)) { if (logger.isDebugEnabled()) { logger.debug("Releasing body, not yet subscribed"); } this.bodyIntern() .doOnNext(byteBuf -> {}) .subs...
if (mayHaveBody(method) && this.state.compareAndSet(ReactorNettyResponseState.NOT_SUBSCRIBED, ReactorNettyResponseState.CANCELLED)) {
private void releaseAfterCancel(HttpMethod method) { if (this.state.compareAndSet(ReactorNettyResponseState.NOT_SUBSCRIBED, ReactorNettyResponseState.CANCELLED)) { if (logger.isDebugEnabled()) { logger.debug("Releasing body, not yet subscribed"); } this.bodyIntern() .doOnNext(byteBuf -> {}) .subscribe(byteBuf -> {}, ex...
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...
Since we are draining content here, we want to make sure we drain it under very specific conditions, specially when the body can be present.
private void releaseAfterCancel(HttpMethod method) { if (mayHaveBody(method) && this.state.compareAndSet(ReactorNettyResponseState.NOT_SUBSCRIBED, ReactorNettyResponseState.CANCELLED)) { if (logger.isDebugEnabled()) { logger.debug("Releasing body, not yet subscribed"); } this.bodyIntern() .doOnNext(byteBuf -> {}) .subs...
if (mayHaveBody(method) && this.state.compareAndSet(ReactorNettyResponseState.NOT_SUBSCRIBED, ReactorNettyResponseState.CANCELLED)) {
private void releaseAfterCancel(HttpMethod method) { if (this.state.compareAndSet(ReactorNettyResponseState.NOT_SUBSCRIBED, ReactorNettyResponseState.CANCELLED)) { if (logger.isDebugEnabled()) { logger.debug("Releasing body, not yet subscribed"); } this.bodyIntern() .doOnNext(byteBuf -> {}) .subscribe(byteBuf -> {}, ex...
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...
That is fine ,but my doubt is if some valid response miss mayHaveBody (due to any missed scenario), then we will still face issue , vs draining non body too along with body response (Its a trade off thing )
private void releaseAfterCancel(HttpMethod method) { if (mayHaveBody(method) && this.state.compareAndSet(ReactorNettyResponseState.NOT_SUBSCRIBED, ReactorNettyResponseState.CANCELLED)) { if (logger.isDebugEnabled()) { logger.debug("Releasing body, not yet subscribed"); } this.bodyIntern() .doOnNext(byteBuf -> {}) .subs...
if (mayHaveBody(method) && this.state.compareAndSet(ReactorNettyResponseState.NOT_SUBSCRIBED, ReactorNettyResponseState.CANCELLED)) {
private void releaseAfterCancel(HttpMethod method) { if (this.state.compareAndSet(ReactorNettyResponseState.NOT_SUBSCRIBED, ReactorNettyResponseState.CANCELLED)) { if (logger.isDebugEnabled()) { logger.debug("Releasing body, not yet subscribed"); } this.bodyIntern() .doOnNext(byteBuf -> {}) .subscribe(byteBuf -> {}, ex...
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...
Does GSON maintain full method names or does it drop Java bean notation? I know in Jackson's case this would serialize as `hotelName` (possibly `HotelName` as I'm not completely certain about how it handles casing).
public void testPropertyNameOnMethodName() throws NoSuchMethodException { class Hotel { String hotelName; public String getHotelName() { return hotelName; } } Method m = Hotel.class.getDeclaredMethod("getHotelName"); assertMemberValue(m, "getHotelName"); }
assertMemberValue(m, "getHotelName");
public void testPropertyNameOnMethodName() throws NoSuchMethodException { class LocalHotel { String hotelName; public String getHotelName() { return hotelName; } } Method m = LocalHotel.class.getDeclaredMethod("getHotelName"); assertNull(serializer.convertMemberName(m)); }
class Hotel { @SerializedName(value = "") String hotelName; }
class LocalHotel { @SerializedName(value = "") String hotelName; }
This won't be how Jackson default handles a `JsonProperty` annotated method, it'll attempt to remove the Java bean prefix of `get` or `is`.
public String convertMemberName(Member member) { if (member instanceof Field) { Field f = (Field) member; if (f.isAnnotationPresent(JsonIgnore.class)) { return null; } if (f.isAnnotationPresent(JsonProperty.class)) { String propertyName = f.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmp...
return member.getName();
public String convertMemberName(Member member) { if (Modifier.isTransient(member.getModifiers())) { return null; } if (member instanceof Field) { Field f = (Field) member; if (f.isAnnotationPresent(JsonIgnore.class)) { return null; } if (f.isAnnotationPresent(JsonProperty.class)) { String propertyName = f.getDeclaredAn...
class JacksonJsonSerializer implements MemberNameConverter, JsonSerializer { private final ClientLogger logger = new ClientLogger(JacksonJsonSerializer.class); private final ObjectMapper mapper; private final TypeFactory typeFactory; /** * Constructs a {@link JsonSerializer} using the passed Jackson serializer. * * @pa...
class JacksonJsonSerializer implements MemberNameConverter, JsonSerializer { private final ClientLogger logger = new ClientLogger(JacksonJsonSerializer.class); private final ObjectMapper mapper; private final TypeFactory typeFactory; /** * Constructs a {@link JsonSerializer} using the passed Jackson serializer. * * @pa...
Jackson can serialize property name invoked getter even it is not in a format of `get{PropertyName}`. JavaBeans has limitation on reading this. In order to achieve what Jackson does, we have to introduce a really complicated logic in core, which also bring the risk in core. Talked offline, we can leave the function i...
public String convertMemberName(Member member) { if (member instanceof Field) { Field f = (Field) member; if (f.isAnnotationPresent(JsonIgnore.class)) { return null; } if (f.isAnnotationPresent(JsonProperty.class)) { String propertyName = f.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmp...
return member.getName();
public String convertMemberName(Member member) { if (Modifier.isTransient(member.getModifiers())) { return null; } if (member instanceof Field) { Field f = (Field) member; if (f.isAnnotationPresent(JsonIgnore.class)) { return null; } if (f.isAnnotationPresent(JsonProperty.class)) { String propertyName = f.getDeclaredAn...
class JacksonJsonSerializer implements MemberNameConverter, JsonSerializer { private final ClientLogger logger = new ClientLogger(JacksonJsonSerializer.class); private final ObjectMapper mapper; private final TypeFactory typeFactory; /** * Constructs a {@link JsonSerializer} using the passed Jackson serializer. * * @pa...
class JacksonJsonSerializer implements MemberNameConverter, JsonSerializer { private final ClientLogger logger = new ClientLogger(JacksonJsonSerializer.class); private final ObjectMapper mapper; private final TypeFactory typeFactory; /** * Constructs a {@link JsonSerializer} using the passed Jackson serializer. * * @pa...
Should there be validation to check if it is in the correct format?
public void supplementalResponseStatisticsList() throws Exception { ClientSideRequestStatistics clientSideRequestStatistics = new ClientSideRequestStatistics(); for (int i = 0; i < 15; i++) { RxDocumentServiceRequest rxDocumentServiceRequest = RxDocumentServiceRequest.create(OperationType.Head, ResourceType.Document); ...
assertThat(node.get("requestResponseTimeUTC")).isNotNull();
public void supplementalResponseStatisticsList() throws Exception { ClientSideRequestStatistics clientSideRequestStatistics = new ClientSideRequestStatistics(); for (int i = 0; i < 15; i++) { RxDocumentServiceRequest rxDocumentServiceRequest = RxDocumentServiceRequest.create(OperationType.Head, ResourceType.Document); ...
class CosmosDiagnosticsTest extends TestSuiteBase { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"simple"}, timeOut...
class CosmosDiagnosticsTest extends TestSuiteBase { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private static final DateTimeFormatter RESPONSE_TIME_FORMATTER = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss" + ".SSS").withLocale(Locale.US).withZone(ZoneOffset.UTC); private CosmosClient gat...
Added
public void supplementalResponseStatisticsList() throws Exception { ClientSideRequestStatistics clientSideRequestStatistics = new ClientSideRequestStatistics(); for (int i = 0; i < 15; i++) { RxDocumentServiceRequest rxDocumentServiceRequest = RxDocumentServiceRequest.create(OperationType.Head, ResourceType.Document); ...
assertThat(node.get("requestResponseTimeUTC")).isNotNull();
public void supplementalResponseStatisticsList() throws Exception { ClientSideRequestStatistics clientSideRequestStatistics = new ClientSideRequestStatistics(); for (int i = 0; i < 15; i++) { RxDocumentServiceRequest rxDocumentServiceRequest = RxDocumentServiceRequest.create(OperationType.Head, ResourceType.Document); ...
class CosmosDiagnosticsTest extends TestSuiteBase { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"simple"}, timeOut...
class CosmosDiagnosticsTest extends TestSuiteBase { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private static final DateTimeFormatter RESPONSE_TIME_FORMATTER = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss" + ".SSS").withLocale(Locale.US).withZone(ZoneOffset.UTC); private CosmosClient gat...
nit: `switch` would be more natural choice here imo.
public void copyIncrementalWithResponseCodeSnippet2() { final String snapshot = "copy snapshot"; PageBlobCopyIncrementalRequestConditions destinationRequestConditions = new PageBlobCopyIncrementalRequestConditions() .setIfNoneMatch("snapshotMatch"); Context context = new Context(key, value); CopyStatusType statusType =...
if (CopyStatusType.SUCCESS == statusType) {
public void copyIncrementalWithResponseCodeSnippet2() { final String snapshot = "copy snapshot"; PageBlobCopyIncrementalRequestConditions destinationRequestConditions = new PageBlobCopyIncrementalRequestConditions() .setIfNoneMatch("snapshotMatch"); Context context = new Context(key, value); CopyStatusType statusType =...
class PageBlobClientJavaDocCodeSnippets { private PageBlobClient client = new SpecializedBlobClientBuilder().buildPageBlobClient(); private Map<String, String> metadata = Collections.singletonMap("metadata", "value"); private Map<String, String> tags = Collections.singletonMap("tag", "value"); private String leaseId = ...
class PageBlobClientJavaDocCodeSnippets { private PageBlobClient client = new SpecializedBlobClientBuilder().buildPageBlobClient(); private Map<String, String> metadata = Collections.singletonMap("metadata", "value"); private Map<String, String> tags = Collections.singletonMap("tag", "value"); private String leaseId = ...
yeah I can change that. This was just copy pasted from the original snippet
public void copyIncrementalWithResponseCodeSnippet2() { final String snapshot = "copy snapshot"; PageBlobCopyIncrementalRequestConditions destinationRequestConditions = new PageBlobCopyIncrementalRequestConditions() .setIfNoneMatch("snapshotMatch"); Context context = new Context(key, value); CopyStatusType statusType =...
if (CopyStatusType.SUCCESS == statusType) {
public void copyIncrementalWithResponseCodeSnippet2() { final String snapshot = "copy snapshot"; PageBlobCopyIncrementalRequestConditions destinationRequestConditions = new PageBlobCopyIncrementalRequestConditions() .setIfNoneMatch("snapshotMatch"); Context context = new Context(key, value); CopyStatusType statusType =...
class PageBlobClientJavaDocCodeSnippets { private PageBlobClient client = new SpecializedBlobClientBuilder().buildPageBlobClient(); private Map<String, String> metadata = Collections.singletonMap("metadata", "value"); private Map<String, String> tags = Collections.singletonMap("tag", "value"); private String leaseId = ...
class PageBlobClientJavaDocCodeSnippets { private PageBlobClient client = new SpecializedBlobClientBuilder().buildPageBlobClient(); private Map<String, String> metadata = Collections.singletonMap("metadata", "value"); private Map<String, String> tags = Collections.singletonMap("tag", "value"); private String leaseId = ...
nit: no need for extra variable creation here.
Mono<PiiEntityCollection> recognizePiiEntities(String document, String language) { try { Objects.requireNonNull(document, "'document' cannot be null."); final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document).setLanguage(language); return recognizePiiEntitiesBatch(Collections.singletonList(text...
final TextDocumentInput textDocumentInput = new TextDocumentInput("0", document).setLanguage(language);
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...
Do we need this check here too?
public PiiEntityCollection recognizePiiEntities(String document, String language) { Objects.requireNonNull(document, "'document' cannot be null."); return client.recognizePiiEntities(document, language).block(); }
Objects.requireNonNull(document, "'document' cannot be null.");
public PiiEntityCollection recognizePiiEntities(String document, String language) { Objects.requireNonNull(document, "'document' cannot be null."); return client.recognizePiiEntities(document, language).block(); }
class TextAnalyticsClient { private final TextAnalyticsAsyncClient client; /** * Create a {@code TextAnalyticsClient client} that sends requests to the Text Analytics service's endpoint. * Each service call goes through the {@link TextAnalyticsClientBuilder * * @param client The {@link TextAnalyticsClient} that the cli...
class TextAnalyticsClient { private final TextAnalyticsAsyncClient client; /** * Create a {@code TextAnalyticsClient client} that sends requests to the Text Analytics service's endpoint. * Each service call goes through the {@link TextAnalyticsClientBuilder * * @param client The {@link TextAnalyticsClient} that the cli...
make sure to keep this concise as this gets added in between the java docs and could make the docs really verbose!
public void recognizePiiEntitiesStringListWithOptions() { List<String> documents = Arrays.asList( "My SSN is 555-55-5555.", "Visa card 0111 1111 1111 1111." ); TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setIncludeStatistics(true) .setModelVersion("latest"); textAnalyticsAsyncClient.r...
+ " entity subcategory: %s, offset: %s, length: %s, confidence score: %f.%n",
public void recognizePiiEntitiesStringListWithOptions() { List<String> documents = Arrays.asList( "My SSN is 859-98-0987.", "Visa card 0111 1111 1111 1111." ); TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setIncludeStatistics(true) .setModelVersion("latest"); textAnalyticsAsyncClient.r...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
class TextAnalyticsAsyncClientJavaDocCodeSnippets { TextAnalyticsAsyncClient textAnalyticsAsyncClient = createTextAnalyticsAsyncClient(); /** * Code snippet for creating a {@link TextAnalyticsAsyncClient} * * @return The TextAnalyticsAsyncClient object */ public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient()...
it check for atomic single document. For atomic single operation, document can't be null but can be empty. For batch operation, document**s** can not be null and empty list.
public PiiEntityCollection recognizePiiEntities(String document, String language) { Objects.requireNonNull(document, "'document' cannot be null."); return client.recognizePiiEntities(document, language).block(); }
Objects.requireNonNull(document, "'document' cannot be null.");
public PiiEntityCollection recognizePiiEntities(String document, String language) { Objects.requireNonNull(document, "'document' cannot be null."); return client.recognizePiiEntities(document, language).block(); }
class TextAnalyticsClient { private final TextAnalyticsAsyncClient client; /** * Create a {@code TextAnalyticsClient client} that sends requests to the Text Analytics service's endpoint. * Each service call goes through the {@link TextAnalyticsClientBuilder * * @param client The {@link TextAnalyticsClient} that the cli...
class TextAnalyticsClient { private final TextAnalyticsAsyncClient client; /** * Create a {@code TextAnalyticsClient client} that sends requests to the Text Analytics service's endpoint. * Each service call goes through the {@link TextAnalyticsClientBuilder * * @param client The {@link TextAnalyticsClient} that the cli...