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
That's true. My opinion is to leave insensitive data over there as Json file is also a good and quick reference of what the request and response are composed of. It is cheap to have the information over there. However, I am flexible of making change to replace all.
private void redactedAccountName(UrlBuilder urlBuilder) { String[] hostParts = urlBuilder.getHost().split("\\."); hostParts[0] = "REDACTED"; urlBuilder.setHost(String.join(".", hostParts)); }
hostParts[0] = "REDACTED";
private void redactedAccountName(UrlBuilder urlBuilder) { String[] hostParts = urlBuilder.getHost().split("\\."); hostParts[0] = "REDACTED"; urlBuilder.setHost(String.join(".", hostParts)); }
class RecordNetworkCallPolicy implements HttpPipelinePolicy { private static final int DEFAULT_BUFFER_LENGTH = 1024; private static final String CONTENT_TYPE = "Content-Type"; private static final String CONTENT_ENCODING = "Content-Encoding"; private static final String CONTENT_LENGTH = "Content-Length"; private static...
class RecordNetworkCallPolicy implements HttpPipelinePolicy { private static final int DEFAULT_BUFFER_LENGTH = 1024; private static final String CONTENT_TYPE = "Content-Type"; private static final String CONTENT_ENCODING = "Content-Encoding"; private static final String CONTENT_LENGTH = "Content-Length"; private static...
Any reason why we look for only these 3 charsets and not others? Adding a comment here to explain that would be good.
public Mono<String> getBodyAsString() { return getBodyAsByteArray().map(bytes -> { if (bytes.length >= 3 && bytes[0] == (byte) 239 && bytes[1] == (byte) 187 && bytes[2] == (byte) 191) { return new String(bytes, 3, bytes.length - 3, StandardCharsets.UTF_8); } else if (bytes.length >= 2 && bytes[0] == (byte) 254 && bytes...
return new String(bytes, 2, bytes.length - 2, StandardCharsets.UTF_16LE);
public Mono<String> getBodyAsString() { return getBodyAsByteArray().map(bytes -> CoreUtils.bomAwareToString(bytes, headers.getValue("Content-Type"))); }
class JdkHttpResponse extends HttpResponse { private final int statusCode; private final HttpHeaders headers; private final Flux<ByteBuffer> contentFlux; private volatile boolean disposed = false; protected JdkHttpResponse(final HttpRequest request, java.net.http.HttpResponse<Flow.Publisher<List<ByteBuffer>>> innerResp...
class JdkHttpResponse extends HttpResponse { private final int statusCode; private final HttpHeaders headers; private final Flux<ByteBuffer> contentFlux; private volatile boolean disposed = false; protected JdkHttpResponse(final HttpRequest request, java.net.http.HttpResponse<Flow.Publisher<List<ByteBuffer>>> innerResp...
Both JDK client and Netty client have to do the same logic for converting response byte array to string. It would be better to put this in Core utils somewhere to reduce duplication and if there are any fixes or updates to this logic, we don't need to update in two places.
public Mono<String> getBodyAsString() { return getBodyAsByteArray().map(bytes -> { if (bytes.length >= 3 && bytes[0] == (byte) 239 && bytes[1] == (byte) 187 && bytes[2] == (byte) 191) { return new String(bytes, 3, bytes.length - 3, StandardCharsets.UTF_8); } else if (bytes.length >= 2 && bytes[0] == (byte) 254 && bytes...
return getBodyAsByteArray().map(bytes -> {
public Mono<String> getBodyAsString() { return getBodyAsByteArray().map(bytes -> CoreUtils.bomAwareToString(bytes, reactorNettyResponse.responseHeaders().get("Content-Type"))); }
class ReactorNettyHttpResponse extends HttpResponse { private final HttpClientResponse reactorNettyResponse; private final Connection reactorNettyConnection; private final boolean disableBufferCopy; ReactorNettyHttpResponse(HttpClientResponse reactorNettyResponse, Connection reactorNettyConnection, HttpRequest httpRequ...
class ReactorNettyHttpResponse extends HttpResponse { private final HttpClientResponse reactorNettyResponse; private final Connection reactorNettyConnection; private final boolean disableBufferCopy; ReactorNettyHttpResponse(HttpClientResponse reactorNettyResponse, Connection reactorNettyConnection, HttpRequest httpRequ...
Yeah I was thinking about that, also would give the opportunity to test is more directly and thoroughly.
public Mono<String> getBodyAsString() { return getBodyAsByteArray().map(bytes -> { if (bytes.length >= 3 && bytes[0] == (byte) 239 && bytes[1] == (byte) 187 && bytes[2] == (byte) 191) { return new String(bytes, 3, bytes.length - 3, StandardCharsets.UTF_8); } else if (bytes.length >= 2 && bytes[0] == (byte) 254 && bytes...
return getBodyAsByteArray().map(bytes -> {
public Mono<String> getBodyAsString() { return getBodyAsByteArray().map(bytes -> CoreUtils.bomAwareToString(bytes, reactorNettyResponse.responseHeaders().get("Content-Type"))); }
class ReactorNettyHttpResponse extends HttpResponse { private final HttpClientResponse reactorNettyResponse; private final Connection reactorNettyConnection; private final boolean disableBufferCopy; ReactorNettyHttpResponse(HttpClientResponse reactorNettyResponse, Connection reactorNettyConnection, HttpRequest httpRequ...
class ReactorNettyHttpResponse extends HttpResponse { private final HttpClientResponse reactorNettyResponse; private final Connection reactorNettyConnection; private final boolean disableBufferCopy; ReactorNettyHttpResponse(HttpClientResponse reactorNettyResponse, Connection reactorNettyConnection, HttpRequest httpRequ...
Added support for `UTF-32BE` and `UTF-32LE`
public Mono<String> getBodyAsString() { return getBodyAsByteArray().map(bytes -> { if (bytes.length >= 3 && bytes[0] == (byte) 239 && bytes[1] == (byte) 187 && bytes[2] == (byte) 191) { return new String(bytes, 3, bytes.length - 3, StandardCharsets.UTF_8); } else if (bytes.length >= 2 && bytes[0] == (byte) 254 && bytes...
return new String(bytes, 2, bytes.length - 2, StandardCharsets.UTF_16LE);
public Mono<String> getBodyAsString() { return getBodyAsByteArray().map(bytes -> CoreUtils.bomAwareToString(bytes, headers.getValue("Content-Type"))); }
class JdkHttpResponse extends HttpResponse { private final int statusCode; private final HttpHeaders headers; private final Flux<ByteBuffer> contentFlux; private volatile boolean disposed = false; protected JdkHttpResponse(final HttpRequest request, java.net.http.HttpResponse<Flow.Publisher<List<ByteBuffer>>> innerResp...
class JdkHttpResponse extends HttpResponse { private final int statusCode; private final HttpHeaders headers; private final Flux<ByteBuffer> contentFlux; private volatile boolean disposed = false; protected JdkHttpResponse(final HttpRequest request, java.net.http.HttpResponse<Flow.Publisher<List<ByteBuffer>>> innerResp...
Done, also resolved another TODO
public void canPostDeploymentWhatIfOnResourceGroup() throws Exception { final String dpName = "dpA" + testId; resourceClient.deployments() .define(dpName) .withExistingResourceGroup(rgName) .withTemplateLink(templateUri, contentVersion) .withParametersLink(parametersUri, contentVersion) .withMode(DeploymentMode.COMPLET...
public void canPostDeploymentWhatIfOnResourceGroup() throws Exception { final String dpName = "dpA" + testId; resourceClient.deployments() .define(dpName) .withExistingResourceGroup(rgName) .withTemplateLink(templateUri, contentVersion) .withParametersLink(parametersUri, contentVersion) .withMode(DeploymentMode.COMPLET...
class DeploymentsTests extends ResourceManagerTestBase { private ResourceGroups resourceGroups; private ResourceGroup resourceGroup; private String testId; private String rgName; private static String templateUri = "https: private static String blankTemplateUri = "https: private static String parametersUri = "https: pr...
class DeploymentsTests extends ResourceManagerTestBase { private ResourceGroups resourceGroups; private ResourceGroup resourceGroup; private String testId; private String rgName; private static String templateUri = "https: private static String blankTemplateUri = "https: private static String parametersUri = "https: pr...
You need to change the set part? e.g. `withPublicAccess`
public Mono<BlobContainer> createResourceAsync() { BlobContainersInner client = this.manager().inner().blobContainers(); return client .createAsync(this.resourceGroupName, this.accountName, this.containerName, this.inner()) .map(innerToFluentMap(this)); }
.createAsync(this.resourceGroupName, this.accountName, this.containerName, this.inner())
public Mono<BlobContainer> createResourceAsync() { BlobContainersInner client = this.manager().inner().blobContainers(); return client .createAsync(this.resourceGroupName, this.accountName, this.containerName, this.inner().withPublicAccess(cpublicAccess).withMetadata(cmetadata)) .map(innerToFluentMap(this)); }
class BlobContainerImpl extends CreatableUpdatableImpl<BlobContainer, BlobContainerInner, BlobContainerImpl> implements BlobContainer, BlobContainer.Definition, BlobContainer.Update { private final StorageManager manager; private String resourceGroupName; private String accountName; private String containerName; privat...
class BlobContainerImpl extends CreatableUpdatableImpl<BlobContainer, BlobContainerInner, BlobContainerImpl> implements BlobContainer, BlobContainer.Definition, BlobContainer.Update { private final StorageManager manager; private String resourceGroupName; private String accountName; private String containerName; privat...
I'll take a look.
public Mono<BlobContainer> createResourceAsync() { BlobContainersInner client = this.manager().inner().blobContainers(); return client .createAsync(this.resourceGroupName, this.accountName, this.containerName, this.inner()) .map(innerToFluentMap(this)); }
.createAsync(this.resourceGroupName, this.accountName, this.containerName, this.inner())
public Mono<BlobContainer> createResourceAsync() { BlobContainersInner client = this.manager().inner().blobContainers(); return client .createAsync(this.resourceGroupName, this.accountName, this.containerName, this.inner().withPublicAccess(cpublicAccess).withMetadata(cmetadata)) .map(innerToFluentMap(this)); }
class BlobContainerImpl extends CreatableUpdatableImpl<BlobContainer, BlobContainerInner, BlobContainerImpl> implements BlobContainer, BlobContainer.Definition, BlobContainer.Update { private final StorageManager manager; private String resourceGroupName; private String accountName; private String containerName; privat...
class BlobContainerImpl extends CreatableUpdatableImpl<BlobContainer, BlobContainerInner, BlobContainerImpl> implements BlobContainer, BlobContainer.Definition, BlobContainer.Update { private final StorageManager manager; private String resourceGroupName; private String accountName; private String containerName; privat...
Add parameter done.
public Mono<BlobContainer> createResourceAsync() { BlobContainersInner client = this.manager().inner().blobContainers(); return client .createAsync(this.resourceGroupName, this.accountName, this.containerName, this.inner()) .map(innerToFluentMap(this)); }
.createAsync(this.resourceGroupName, this.accountName, this.containerName, this.inner())
public Mono<BlobContainer> createResourceAsync() { BlobContainersInner client = this.manager().inner().blobContainers(); return client .createAsync(this.resourceGroupName, this.accountName, this.containerName, this.inner().withPublicAccess(cpublicAccess).withMetadata(cmetadata)) .map(innerToFluentMap(this)); }
class BlobContainerImpl extends CreatableUpdatableImpl<BlobContainer, BlobContainerInner, BlobContainerImpl> implements BlobContainer, BlobContainer.Definition, BlobContainer.Update { private final StorageManager manager; private String resourceGroupName; private String accountName; private String containerName; privat...
class BlobContainerImpl extends CreatableUpdatableImpl<BlobContainer, BlobContainerInner, BlobContainerImpl> implements BlobContainer, BlobContainer.Definition, BlobContainer.Update { private final StorageManager manager; private String resourceGroupName; private String accountName; private String containerName; privat...
Better still use the enum
public NetworkSecurityRuleImpl withAnyProtocol() { return this.withProtocol(SecurityRuleProtocol.fromString("*")); }
return this.withProtocol(SecurityRuleProtocol.fromString("*"));
public NetworkSecurityRuleImpl withAnyProtocol() { return this.withProtocol(SecurityRuleProtocol.STAR); }
class NetworkSecurityRuleImpl extends ChildResourceImpl<SecurityRuleInner, NetworkSecurityGroupImpl, NetworkSecurityGroup> implements NetworkSecurityRule, NetworkSecurityRule.Definition<NetworkSecurityGroup.DefinitionStages.WithCreate>, NetworkSecurityRule.UpdateDefinition<NetworkSecurityGroup.Update>, NetworkSecurityR...
class NetworkSecurityRuleImpl extends ChildResourceImpl<SecurityRuleInner, NetworkSecurityGroupImpl, NetworkSecurityGroup> implements NetworkSecurityRule, NetworkSecurityRule.Definition<NetworkSecurityGroup.DefinitionStages.WithCreate>, NetworkSecurityRule.UpdateDefinition<NetworkSecurityGroup.Update>, NetworkSecurityR...
This TODO can be solved now
protected Mono<NetworkInterfaceInner> getInnerAsync() { return this .manager() .inner() .networkInterfaces() .getByResourceGroupAsync(this.resourceGroupName(), this.name(), null); }
protected Mono<NetworkInterfaceInner> getInnerAsync() { return this .manager() .inner() .networkInterfaces() .getByResourceGroupAsync(this.resourceGroupName(), this.name()); }
class NetworkInterfaceImpl extends GroupableParentResourceWithTagsImpl< NetworkInterface, NetworkInterfaceInner, NetworkInterfaceImpl, NetworkManager> implements NetworkInterface, NetworkInterface.Definition, NetworkInterface.Update { /** the name of the network interface. */ private final String nicName; /** used to g...
class NetworkInterfaceImpl extends GroupableParentResourceWithTagsImpl< NetworkInterface, NetworkInterfaceInner, NetworkInterfaceImpl, NetworkManager> implements NetworkInterface, NetworkInterface.Definition, NetworkInterface.Update { /** the name of the network interface. */ private final String nicName; /** used to g...
I think from string will not change at all. Instead, the enum name is still not ready after discussed.
public NetworkSecurityRuleImpl withAnyProtocol() { return this.withProtocol(SecurityRuleProtocol.fromString("*")); }
return this.withProtocol(SecurityRuleProtocol.fromString("*"));
public NetworkSecurityRuleImpl withAnyProtocol() { return this.withProtocol(SecurityRuleProtocol.STAR); }
class NetworkSecurityRuleImpl extends ChildResourceImpl<SecurityRuleInner, NetworkSecurityGroupImpl, NetworkSecurityGroup> implements NetworkSecurityRule, NetworkSecurityRule.Definition<NetworkSecurityGroup.DefinitionStages.WithCreate>, NetworkSecurityRule.UpdateDefinition<NetworkSecurityGroup.Update>, NetworkSecurityR...
class NetworkSecurityRuleImpl extends ChildResourceImpl<SecurityRuleInner, NetworkSecurityGroupImpl, NetworkSecurityGroup> implements NetworkSecurityRule, NetworkSecurityRule.Definition<NetworkSecurityGroup.DefinitionStages.WithCreate>, NetworkSecurityRule.UpdateDefinition<NetworkSecurityGroup.Update>, NetworkSecurityR...
Should be solved.
protected Mono<NetworkSecurityGroupInner> getInnerAsync() { return this .manager() .inner() .networkSecurityGroups() .getByResourceGroupAsync(this.resourceGroupName(), this.name(), null); }
protected Mono<NetworkSecurityGroupInner> getInnerAsync() { return this .manager() .inner() .networkSecurityGroups() .getByResourceGroupAsync(this.resourceGroupName(), this.name()); }
class NetworkSecurityGroupImpl extends GroupableParentResourceWithTagsImpl< NetworkSecurityGroup, NetworkSecurityGroupInner, NetworkSecurityGroupImpl, NetworkManager> implements NetworkSecurityGroup, NetworkSecurityGroup.Definition, NetworkSecurityGroup.Update { private Map<String, NetworkSecurityRule> rules; private M...
class NetworkSecurityGroupImpl extends GroupableParentResourceWithTagsImpl< NetworkSecurityGroup, NetworkSecurityGroupInner, NetworkSecurityGroupImpl, NetworkManager> implements NetworkSecurityGroup, NetworkSecurityGroup.Definition, NetworkSecurityGroup.Update { private Map<String, NetworkSecurityRule> rules; private M...
Should all expand TODO remain `null`?
protected Mono<NetworkInterfaceInner> getInnerAsync() { return this .manager() .inner() .networkInterfaces() .getByResourceGroupAsync(this.resourceGroupName(), this.name(), null); }
protected Mono<NetworkInterfaceInner> getInnerAsync() { return this .manager() .inner() .networkInterfaces() .getByResourceGroupAsync(this.resourceGroupName(), this.name()); }
class NetworkInterfaceImpl extends GroupableParentResourceWithTagsImpl< NetworkInterface, NetworkInterfaceInner, NetworkInterfaceImpl, NetworkManager> implements NetworkInterface, NetworkInterface.Definition, NetworkInterface.Update { /** the name of the network interface. */ private final String nicName; /** used to g...
class NetworkInterfaceImpl extends GroupableParentResourceWithTagsImpl< NetworkInterface, NetworkInterfaceInner, NetworkInterfaceImpl, NetworkManager> implements NetworkInterface, NetworkInterface.Definition, NetworkInterface.Update { /** the name of the network interface. */ private final String nicName; /** used to g...
If the call is using `null` it could now be deleted. This is yaohai adding these `null`s when method call with defaults not ready.
protected Mono<NetworkInterfaceInner> getInnerAsync() { return this .manager() .inner() .networkInterfaces() .getByResourceGroupAsync(this.resourceGroupName(), this.name(), null); }
protected Mono<NetworkInterfaceInner> getInnerAsync() { return this .manager() .inner() .networkInterfaces() .getByResourceGroupAsync(this.resourceGroupName(), this.name()); }
class NetworkInterfaceImpl extends GroupableParentResourceWithTagsImpl< NetworkInterface, NetworkInterfaceInner, NetworkInterfaceImpl, NetworkManager> implements NetworkInterface, NetworkInterface.Definition, NetworkInterface.Update { /** the name of the network interface. */ private final String nicName; /** used to g...
class NetworkInterfaceImpl extends GroupableParentResourceWithTagsImpl< NetworkInterface, NetworkInterfaceInner, NetworkInterfaceImpl, NetworkManager> implements NetworkInterface, NetworkInterface.Definition, NetworkInterface.Update { /** the name of the network interface. */ private final String nicName; /** used to g...
The point is when generator changes the enum name, no compiler will tell anyone anything about this line. Runtime there might be error, if tests has it.
public NetworkSecurityRuleImpl withAnyProtocol() { return this.withProtocol(SecurityRuleProtocol.fromString("*")); }
return this.withProtocol(SecurityRuleProtocol.fromString("*"));
public NetworkSecurityRuleImpl withAnyProtocol() { return this.withProtocol(SecurityRuleProtocol.STAR); }
class NetworkSecurityRuleImpl extends ChildResourceImpl<SecurityRuleInner, NetworkSecurityGroupImpl, NetworkSecurityGroup> implements NetworkSecurityRule, NetworkSecurityRule.Definition<NetworkSecurityGroup.DefinitionStages.WithCreate>, NetworkSecurityRule.UpdateDefinition<NetworkSecurityGroup.Update>, NetworkSecurityR...
class NetworkSecurityRuleImpl extends ChildResourceImpl<SecurityRuleInner, NetworkSecurityGroupImpl, NetworkSecurityGroup> implements NetworkSecurityRule, NetworkSecurityRule.Definition<NetworkSecurityGroup.DefinitionStages.WithCreate>, NetworkSecurityRule.UpdateDefinition<NetworkSecurityGroup.Update>, NetworkSecurityR...
Yes, I change it back. But I think the `any` should not be other char than '*'.
public NetworkSecurityRuleImpl withAnyProtocol() { return this.withProtocol(SecurityRuleProtocol.fromString("*")); }
return this.withProtocol(SecurityRuleProtocol.fromString("*"));
public NetworkSecurityRuleImpl withAnyProtocol() { return this.withProtocol(SecurityRuleProtocol.STAR); }
class NetworkSecurityRuleImpl extends ChildResourceImpl<SecurityRuleInner, NetworkSecurityGroupImpl, NetworkSecurityGroup> implements NetworkSecurityRule, NetworkSecurityRule.Definition<NetworkSecurityGroup.DefinitionStages.WithCreate>, NetworkSecurityRule.UpdateDefinition<NetworkSecurityGroup.Update>, NetworkSecurityR...
class NetworkSecurityRuleImpl extends ChildResourceImpl<SecurityRuleInner, NetworkSecurityGroupImpl, NetworkSecurityGroup> implements NetworkSecurityRule, NetworkSecurityRule.Definition<NetworkSecurityGroup.DefinitionStages.WithCreate>, NetworkSecurityRule.UpdateDefinition<NetworkSecurityGroup.Update>, NetworkSecurityR...
done
protected Mono<NetworkInterfaceInner> getInnerAsync() { return this .manager() .inner() .networkInterfaces() .getByResourceGroupAsync(this.resourceGroupName(), this.name(), null); }
protected Mono<NetworkInterfaceInner> getInnerAsync() { return this .manager() .inner() .networkInterfaces() .getByResourceGroupAsync(this.resourceGroupName(), this.name()); }
class NetworkInterfaceImpl extends GroupableParentResourceWithTagsImpl< NetworkInterface, NetworkInterfaceInner, NetworkInterfaceImpl, NetworkManager> implements NetworkInterface, NetworkInterface.Definition, NetworkInterface.Update { /** the name of the network interface. */ private final String nicName; /** used to g...
class NetworkInterfaceImpl extends GroupableParentResourceWithTagsImpl< NetworkInterface, NetworkInterfaceInner, NetworkInterfaceImpl, NetworkManager> implements NetworkInterface, NetworkInterface.Definition, NetworkInterface.Update { /** the name of the network interface. */ private final String nicName; /** used to g...
done
protected Mono<NetworkSecurityGroupInner> getInnerAsync() { return this .manager() .inner() .networkSecurityGroups() .getByResourceGroupAsync(this.resourceGroupName(), this.name(), null); }
protected Mono<NetworkSecurityGroupInner> getInnerAsync() { return this .manager() .inner() .networkSecurityGroups() .getByResourceGroupAsync(this.resourceGroupName(), this.name()); }
class NetworkSecurityGroupImpl extends GroupableParentResourceWithTagsImpl< NetworkSecurityGroup, NetworkSecurityGroupInner, NetworkSecurityGroupImpl, NetworkManager> implements NetworkSecurityGroup, NetworkSecurityGroup.Definition, NetworkSecurityGroup.Update { private Map<String, NetworkSecurityRule> rules; private M...
class NetworkSecurityGroupImpl extends GroupableParentResourceWithTagsImpl< NetworkSecurityGroup, NetworkSecurityGroupInner, NetworkSecurityGroupImpl, NetworkManager> implements NetworkSecurityGroup, NetworkSecurityGroup.Definition, NetworkSecurityGroup.Update { private Map<String, NetworkSecurityRule> rules; private M...
Eh, I mean, you could try delete the `null` in `.getByResourceGroupAsync(this.resourceGroupName(), this.name(), null);`. If it compiles then all is good. If not let me know. It should works same on `.getByResourceGroupAsync(this.resourceGroupName(), this.name());` The `null` is there when the above overload method is ...
protected Mono<LoadBalancerInner> getInnerAsync() { return this .manager() .inner() .loadBalancers() .getByResourceGroupAsync(this.resourceGroupName(), this.name(), null); }
return this
protected Mono<LoadBalancerInner> getInnerAsync() { return this .manager() .inner() .loadBalancers() .getByResourceGroupAsync(this.resourceGroupName(), this.name()); }
class LoadBalancerImpl extends GroupableParentResourceWithTagsImpl<LoadBalancer, LoadBalancerInner, LoadBalancerImpl, NetworkManager> implements LoadBalancer, LoadBalancer.Definition, LoadBalancer.Update { private final ClientLogger logger = new ClientLogger(getClass()); private final Map<String, String> nicsInBackends...
class LoadBalancerImpl extends GroupableParentResourceWithTagsImpl<LoadBalancer, LoadBalancerInner, LoadBalancerImpl, NetworkManager> implements LoadBalancer, LoadBalancer.Definition, LoadBalancer.Update { private final ClientLogger logger = new ClientLogger(getClass()); private final Map<String, String> nicsInBackends...
Done
protected Mono<LoadBalancerInner> getInnerAsync() { return this .manager() .inner() .loadBalancers() .getByResourceGroupAsync(this.resourceGroupName(), this.name(), null); }
return this
protected Mono<LoadBalancerInner> getInnerAsync() { return this .manager() .inner() .loadBalancers() .getByResourceGroupAsync(this.resourceGroupName(), this.name()); }
class LoadBalancerImpl extends GroupableParentResourceWithTagsImpl<LoadBalancer, LoadBalancerInner, LoadBalancerImpl, NetworkManager> implements LoadBalancer, LoadBalancer.Definition, LoadBalancer.Update { private final ClientLogger logger = new ClientLogger(getClass()); private final Map<String, String> nicsInBackends...
class LoadBalancerImpl extends GroupableParentResourceWithTagsImpl<LoadBalancer, LoadBalancerInner, LoadBalancerImpl, NetworkManager> implements LoadBalancer, LoadBalancer.Definition, LoadBalancer.Update { private final ClientLogger logger = new ClientLogger(getClass()); private final Map<String, String> nicsInBackends...
I think you can change the TODO to just a note. I've updated the WAR to fallback to env var with "_" if "." not found.
public static boolean runSample(Azure azure) { final String suffix = ".azurewebsites.net"; final String app1Name = azure.sdkContext().randomResourceName("webapp1-", 20); final String app1Url = app1Name + suffix; final String storageName = azure.sdkContext().randomResourceName("jsdkstore", 20); f...
public static boolean runSample(Azure azure) { final String suffix = ".azurewebsites.net"; final String app1Name = azure.sdkContext().randomResourceName("webapp1-", 20); final String app1Url = app1Name + suffix; final String storageName = azure.sdkContext().randomResourceName("jsdkstore", 20); f...
class ManageLinuxWebAppStorageAccountConnection { /** * Main function which runs the actual sample. * @param azure instance of the azure client * @return true if sample runs successfully */ /** * Main entry point. * @param args the parameters */ public static void main(String[] args) { try { final File credFile = new F...
class ManageLinuxWebAppStorageAccountConnection { /** * Main function which runs the actual sample. * @param azure instance of the azure client * @return true if sample runs successfully */ /** * Main entry point. * @param args the parameters */ public static void main(String[] args) { try { final File credFile = new F...
might not be the best place to define `logger`?
public DockerSSLConfig(String caPem, String keyPem, String certPem) { try { Security.addProvider(new BouncyCastleProvider()); String e = System.getProperty("https.protocols"); System.setProperty("https.protocols", "TLSv1"); sslConfig = SslConfigurator.newInstance(true); if (e != null) { System.setProperty("https.protoc...
ClientLogger logger = new ClientLogger(getClass());
public DockerSSLConfig(String caPem, String keyPem, String certPem) { try { Security.addProvider(new BouncyCastleProvider()); String e = System.getProperty("https.protocols"); System.setProperty("https.protocols", "TLSv1"); sslConfig = SslConfigurator.newInstance(true); if (e != null) { System.setProperty("https.protoc...
class DockerSSLConfig implements SSLConfig, Serializable { private SslConfigurator sslConfig; /** * Constructor for the class. * * @param caPem - content of the ca.pem certificate file * @param keyPem - content of the key.pem certificate file * @param certPem - content of the cert.pem certificate file */ @Override publ...
class DockerSSLConfig implements SSLConfig, Serializable { private SslConfigurator sslConfig; /** * Constructor for the class. * * @param caPem - content of the ca.pem certificate file * @param keyPem - content of the key.pem certificate file * @param certPem - content of the cert.pem certificate file * @throws DockerC...
I have thought logger should not add in class since it is just a sample. Done, change it to comment rather than logger.
public DockerSSLConfig(String caPem, String keyPem, String certPem) { try { Security.addProvider(new BouncyCastleProvider()); String e = System.getProperty("https.protocols"); System.setProperty("https.protocols", "TLSv1"); sslConfig = SslConfigurator.newInstance(true); if (e != null) { System.setProperty("https.protoc...
ClientLogger logger = new ClientLogger(getClass());
public DockerSSLConfig(String caPem, String keyPem, String certPem) { try { Security.addProvider(new BouncyCastleProvider()); String e = System.getProperty("https.protocols"); System.setProperty("https.protocols", "TLSv1"); sslConfig = SslConfigurator.newInstance(true); if (e != null) { System.setProperty("https.protoc...
class DockerSSLConfig implements SSLConfig, Serializable { private SslConfigurator sslConfig; /** * Constructor for the class. * * @param caPem - content of the ca.pem certificate file * @param keyPem - content of the key.pem certificate file * @param certPem - content of the cert.pem certificate file */ @Override publ...
class DockerSSLConfig implements SSLConfig, Serializable { private SslConfigurator sslConfig; /** * Constructor for the class. * * @param caPem - content of the ca.pem certificate file * @param keyPem - content of the key.pem certificate file * @param certPem - content of the cert.pem certificate file * @throws DockerC...
Done
public static boolean runSample(Azure azure) { final String suffix = ".azurewebsites.net"; final String app1Name = azure.sdkContext().randomResourceName("webapp1-", 20); final String app1Url = app1Name + suffix; final String storageName = azure.sdkContext().randomResourceName("jsdkstore", 20); f...
public static boolean runSample(Azure azure) { final String suffix = ".azurewebsites.net"; final String app1Name = azure.sdkContext().randomResourceName("webapp1-", 20); final String app1Url = app1Name + suffix; final String storageName = azure.sdkContext().randomResourceName("jsdkstore", 20); f...
class ManageLinuxWebAppStorageAccountConnection { /** * Main function which runs the actual sample. * @param azure instance of the azure client * @return true if sample runs successfully */ /** * Main entry point. * @param args the parameters */ public static void main(String[] args) { try { final File credFile = new F...
class ManageLinuxWebAppStorageAccountConnection { /** * Main function which runs the actual sample. * @param azure instance of the azure client * @return true if sample runs successfully */ /** * Main entry point. * @param args the parameters */ public static void main(String[] args) { try { final File credFile = new F...
You'll want to move this into the `getBodyAsString` overload without parameters, nothing I've found in Azure Core leverages the `Charset` overload.
public Mono<String> getBodyAsString(Charset charset) { Objects.requireNonNull(charset, "'charset' cannot be null."); return bodyBytes == null ? Mono.empty() : Mono.just(CoreUtils.bomAwareToString(bodyBytes, getHeaderValue("Content-Type"))); }
: Mono.just(CoreUtils.bomAwareToString(bodyBytes, getHeaderValue("Content-Type")));
public Mono<String> getBodyAsString(Charset charset) { Objects.requireNonNull(charset, "'charset' cannot be null."); return bodyBytes == null ? Mono.empty() : Mono.just(new String(bodyBytes, charset)); }
class MockHttpResponse extends HttpResponse { private static final SerializerAdapter SERIALIZER = new JacksonAdapter(); private final int statusCode; private final HttpHeaders headers; private final byte[] bodyBytes; /** * Creates a HTTP response associated with a {@code request}, returns the {@code statusCode}, and ha...
class MockHttpResponse extends HttpResponse { private static final SerializerAdapter SERIALIZER = new JacksonAdapter(); private final int statusCode; private final HttpHeaders headers; private final byte[] bodyBytes; /** * Creates a HTTP response associated with a {@code request}, returns the {@code statusCode}, and ha...
```java public Mono<String> getBodyAsString() { return (bodyBytes == null) ? Mono.empty() : Mono.just(CoreUtils.bomAwareToString(bodyBytes, getHeaderValue("Content-Type")); }
public Mono<String> getBodyAsString(Charset charset) { Objects.requireNonNull(charset, "'charset' cannot be null."); return bodyBytes == null ? Mono.empty() : Mono.just(CoreUtils.bomAwareToString(bodyBytes, getHeaderValue("Content-Type"))); }
: Mono.just(CoreUtils.bomAwareToString(bodyBytes, getHeaderValue("Content-Type")));
public Mono<String> getBodyAsString(Charset charset) { Objects.requireNonNull(charset, "'charset' cannot be null."); return bodyBytes == null ? Mono.empty() : Mono.just(new String(bodyBytes, charset)); }
class MockHttpResponse extends HttpResponse { private static final SerializerAdapter SERIALIZER = new JacksonAdapter(); private final int statusCode; private final HttpHeaders headers; private final byte[] bodyBytes; /** * Creates a HTTP response associated with a {@code request}, returns the {@code statusCode}, and ha...
class MockHttpResponse extends HttpResponse { private static final SerializerAdapter SERIALIZER = new JacksonAdapter(); private final int statusCode; private final HttpHeaders headers; private final byte[] bodyBytes; /** * Creates a HTTP response associated with a {@code request}, returns the {@code statusCode}, and ha...
If create succeeded, then you can break out of the `do-while` loop.
public void createService(TestResourceNamer testResourceNamer) { searchServiceName = testResourceNamer.randomName(SEARCH_SERVICE_NAME_PREFIX, 60); System.out.println("Creating Azure Cognitive Search service: " + searchServiceName); int recreateCount = 0; do { try { searchService = azure.searchServices() .define(searchS...
.create();
public void createService(TestResourceNamer testResourceNamer) { searchServiceName = testResourceNamer.randomName(SEARCH_SERVICE_NAME_PREFIX, 60); System.out.println("Creating Azure Cognitive Search service: " + searchServiceName); int recreateCount = 0; do { try { searchService = azure.searchServices() .define(searchS...
class variables * to be retrieved later. */ public void initialize() { validate(); initializeAzureResources(); if (azure == null) { azure = Azure.configure() .authenticate(azureTokenCredentials) .withSubscription(subscriptionId); } searchDnsSuffix = testEnvironment.equals("DOGFOOD") ? DOGFOOD_DNS_SUFFIX : DEFAULT_DNS_S...
class variables * to be retrieved later. */ public void initialize() { validate(); initializeAzureResources(); if (azure == null) { azure = Azure.configure() .authenticate(azureTokenCredentials) .withSubscription(subscriptionId); } searchDnsSuffix = testEnvironment.equals("DOGFOOD") ? DOGFOOD_DNS_SUFFIX : DEFAULT_DNS_S...
The management plane does not provide us the status of creation. I have to ping the service to confirm. The newly added code is to avoid failure of creating on already exists account.
public void createService(TestResourceNamer testResourceNamer) { searchServiceName = testResourceNamer.randomName(SEARCH_SERVICE_NAME_PREFIX, 60); System.out.println("Creating Azure Cognitive Search service: " + searchServiceName); int recreateCount = 0; do { try { searchService = azure.searchServices() .define(searchS...
.create();
public void createService(TestResourceNamer testResourceNamer) { searchServiceName = testResourceNamer.randomName(SEARCH_SERVICE_NAME_PREFIX, 60); System.out.println("Creating Azure Cognitive Search service: " + searchServiceName); int recreateCount = 0; do { try { searchService = azure.searchServices() .define(searchS...
class variables * to be retrieved later. */ public void initialize() { validate(); initializeAzureResources(); if (azure == null) { azure = Azure.configure() .authenticate(azureTokenCredentials) .withSubscription(subscriptionId); } searchDnsSuffix = testEnvironment.equals("DOGFOOD") ? DOGFOOD_DNS_SUFFIX : DEFAULT_DNS_S...
class variables * to be retrieved later. */ public void initialize() { validate(); initializeAzureResources(); if (azure == null) { azure = Azure.configure() .authenticate(azureTokenCredentials) .withSubscription(subscriptionId); } searchDnsSuffix = testEnvironment.equals("DOGFOOD") ? DOGFOOD_DNS_SUFFIX : DEFAULT_DNS_S...
Could we check the `status` of the `SearchService` object?
public void createService(TestResourceNamer testResourceNamer) { searchServiceName = testResourceNamer.randomName(SEARCH_SERVICE_NAME_PREFIX, 60); System.out.println("Creating Azure Cognitive Search service: " + searchServiceName); int recreateCount = 0; do { try { searchService = azure.searchServices() .define(searchS...
.create();
public void createService(TestResourceNamer testResourceNamer) { searchServiceName = testResourceNamer.randomName(SEARCH_SERVICE_NAME_PREFIX, 60); System.out.println("Creating Azure Cognitive Search service: " + searchServiceName); int recreateCount = 0; do { try { searchService = azure.searchServices() .define(searchS...
class variables * to be retrieved later. */ public void initialize() { validate(); initializeAzureResources(); if (azure == null) { azure = Azure.configure() .authenticate(azureTokenCredentials) .withSubscription(subscriptionId); } searchDnsSuffix = testEnvironment.equals("DOGFOOD") ? DOGFOOD_DNS_SUFFIX : DEFAULT_DNS_S...
class variables * to be retrieved later. */ public void initialize() { validate(); initializeAzureResources(); if (azure == null) { azure = Azure.configure() .authenticate(azureTokenCredentials) .withSubscription(subscriptionId); } searchDnsSuffix = testEnvironment.equals("DOGFOOD") ? DOGFOOD_DNS_SUFFIX : DEFAULT_DNS_S...
Just checked over the API. Find the status one this time. Missing from the initial investigation. Will try to switch to status() checking
public void createService(TestResourceNamer testResourceNamer) { searchServiceName = testResourceNamer.randomName(SEARCH_SERVICE_NAME_PREFIX, 60); System.out.println("Creating Azure Cognitive Search service: " + searchServiceName); int recreateCount = 0; do { try { searchService = azure.searchServices() .define(searchS...
.create();
public void createService(TestResourceNamer testResourceNamer) { searchServiceName = testResourceNamer.randomName(SEARCH_SERVICE_NAME_PREFIX, 60); System.out.println("Creating Azure Cognitive Search service: " + searchServiceName); int recreateCount = 0; do { try { searchService = azure.searchServices() .define(searchS...
class variables * to be retrieved later. */ public void initialize() { validate(); initializeAzureResources(); if (azure == null) { azure = Azure.configure() .authenticate(azureTokenCredentials) .withSubscription(subscriptionId); } searchDnsSuffix = testEnvironment.equals("DOGFOOD") ? DOGFOOD_DNS_SUFFIX : DEFAULT_DNS_S...
class variables * to be retrieved later. */ public void initialize() { validate(); initializeAzureResources(); if (azure == null) { azure = Azure.configure() .authenticate(azureTokenCredentials) .withSubscription(subscriptionId); } searchDnsSuffix = testEnvironment.equals("DOGFOOD") ? DOGFOOD_DNS_SUFFIX : DEFAULT_DNS_S...
I have tried the API they provided. Seems not that stable as service ping. In order to make our live tests more stable. I decided to switch back to ping machenism.
public void createService(TestResourceNamer testResourceNamer) { searchServiceName = testResourceNamer.randomName(SEARCH_SERVICE_NAME_PREFIX, 60); System.out.println("Creating Azure Cognitive Search service: " + searchServiceName); int recreateCount = 0; do { try { searchService = azure.searchServices() .define(searchS...
.create();
public void createService(TestResourceNamer testResourceNamer) { searchServiceName = testResourceNamer.randomName(SEARCH_SERVICE_NAME_PREFIX, 60); System.out.println("Creating Azure Cognitive Search service: " + searchServiceName); int recreateCount = 0; do { try { searchService = azure.searchServices() .define(searchS...
class variables * to be retrieved later. */ public void initialize() { validate(); initializeAzureResources(); if (azure == null) { azure = Azure.configure() .authenticate(azureTokenCredentials) .withSubscription(subscriptionId); } searchDnsSuffix = testEnvironment.equals("DOGFOOD") ? DOGFOOD_DNS_SUFFIX : DEFAULT_DNS_S...
class variables * to be retrieved later. */ public void initialize() { validate(); initializeAzureResources(); if (azure == null) { azure = Azure.configure() .authenticate(azureTokenCredentials) .withSubscription(subscriptionId); } searchDnsSuffix = testEnvironment.equals("DOGFOOD") ? DOGFOOD_DNS_SUFFIX : DEFAULT_DNS_S...
https://dev.azure.com/azure-sdk/internal/_build/results?buildId=356026&view=results
public void createService(TestResourceNamer testResourceNamer) { searchServiceName = testResourceNamer.randomName(SEARCH_SERVICE_NAME_PREFIX, 60); System.out.println("Creating Azure Cognitive Search service: " + searchServiceName); int recreateCount = 0; do { try { searchService = azure.searchServices() .define(searchS...
.create();
public void createService(TestResourceNamer testResourceNamer) { searchServiceName = testResourceNamer.randomName(SEARCH_SERVICE_NAME_PREFIX, 60); System.out.println("Creating Azure Cognitive Search service: " + searchServiceName); int recreateCount = 0; do { try { searchService = azure.searchServices() .define(searchS...
class variables * to be retrieved later. */ public void initialize() { validate(); initializeAzureResources(); if (azure == null) { azure = Azure.configure() .authenticate(azureTokenCredentials) .withSubscription(subscriptionId); } searchDnsSuffix = testEnvironment.equals("DOGFOOD") ? DOGFOOD_DNS_SUFFIX : DEFAULT_DNS_S...
class variables * to be retrieved later. */ public void initialize() { validate(); initializeAzureResources(); if (azure == null) { azure = Azure.configure() .authenticate(azureTokenCredentials) .withSubscription(subscriptionId); } searchDnsSuffix = testEnvironment.equals("DOGFOOD") ? DOGFOOD_DNS_SUFFIX : DEFAULT_DNS_S...
This logic doesn't exist in SB either.... would you mind copy and paste it there? :D Kill two birds with 3 stones?
private ProxyOptions getProxyOptions(ProxyAuthenticationType authentication, String proxyAddress) { String host; int port; if (HOST_PORT_PATTERN.matcher(proxyAddress.trim()).find()) { final String[] hostPort = proxyAddress.split(":"); host = hostPort[0]; port = Integer.parseInt(hostPort[1]); final Proxy proxy = new Pro...
if (HOST_PORT_PATTERN.matcher(proxyAddress.trim()).find()) {
private ProxyOptions getProxyOptions(ProxyAuthenticationType authentication, String proxyAddress) { String host; int port; if (HOST_PORT_PATTERN.matcher(proxyAddress.trim()).find()) { final String[] hostPort = proxyAddress.split(":"); host = hostPort[0]; port = Integer.parseInt(hostPort[1]); final Proxy proxy = new Pro...
class EventHubClientBuilder { static final int DEFAULT_PREFETCH_COUNT = 500; /** * The name of the default consumer group in the Event Hubs service. */ public static final String DEFAULT_CONSUMER_GROUP_NAME = "$Default"; /** * The minimum value allowed for the prefetch count of the consumer. */ private static final int...
class EventHubClientBuilder { static final int DEFAULT_PREFETCH_COUNT = 500; /** * The name of the default consumer group in the Event Hubs service. */ public static final String DEFAULT_CONSUMER_GROUP_NAME = "$Default"; /** * The minimum value allowed for the prefetch count of the consumer. */ private static final int...
Sure, let me fix SB too.
private ProxyOptions getProxyOptions(ProxyAuthenticationType authentication, String proxyAddress) { String host; int port; if (HOST_PORT_PATTERN.matcher(proxyAddress.trim()).find()) { final String[] hostPort = proxyAddress.split(":"); host = hostPort[0]; port = Integer.parseInt(hostPort[1]); final Proxy proxy = new Pro...
if (HOST_PORT_PATTERN.matcher(proxyAddress.trim()).find()) {
private ProxyOptions getProxyOptions(ProxyAuthenticationType authentication, String proxyAddress) { String host; int port; if (HOST_PORT_PATTERN.matcher(proxyAddress.trim()).find()) { final String[] hostPort = proxyAddress.split(":"); host = hostPort[0]; port = Integer.parseInt(hostPort[1]); final Proxy proxy = new Pro...
class EventHubClientBuilder { static final int DEFAULT_PREFETCH_COUNT = 500; /** * The name of the default consumer group in the Event Hubs service. */ public static final String DEFAULT_CONSUMER_GROUP_NAME = "$Default"; /** * The minimum value allowed for the prefetch count of the consumer. */ private static final int...
class EventHubClientBuilder { static final int DEFAULT_PREFETCH_COUNT = 500; /** * The name of the default consumer group in the Event Hubs service. */ public static final String DEFAULT_CONSUMER_GROUP_NAME = "$Default"; /** * The minimum value allowed for the prefetch count of the consumer. */ private static final int...
You're the best! ![](https://media2.giphy.com/media/26AHAw0aMmWwRI4Hm/giphy.gif)
private ProxyOptions getProxyOptions(ProxyAuthenticationType authentication, String proxyAddress) { String host; int port; if (HOST_PORT_PATTERN.matcher(proxyAddress.trim()).find()) { final String[] hostPort = proxyAddress.split(":"); host = hostPort[0]; port = Integer.parseInt(hostPort[1]); final Proxy proxy = new Pro...
if (HOST_PORT_PATTERN.matcher(proxyAddress.trim()).find()) {
private ProxyOptions getProxyOptions(ProxyAuthenticationType authentication, String proxyAddress) { String host; int port; if (HOST_PORT_PATTERN.matcher(proxyAddress.trim()).find()) { final String[] hostPort = proxyAddress.split(":"); host = hostPort[0]; port = Integer.parseInt(hostPort[1]); final Proxy proxy = new Pro...
class EventHubClientBuilder { static final int DEFAULT_PREFETCH_COUNT = 500; /** * The name of the default consumer group in the Event Hubs service. */ public static final String DEFAULT_CONSUMER_GROUP_NAME = "$Default"; /** * The minimum value allowed for the prefetch count of the consumer. */ private static final int...
class EventHubClientBuilder { static final int DEFAULT_PREFETCH_COUNT = 500; /** * The name of the default consumer group in the Event Hubs service. */ public static final String DEFAULT_CONSUMER_GROUP_NAME = "$Default"; /** * The minimum value allowed for the prefetch count of the consumer. */ private static final int...
Here and in all the other tests and samples; can we avoid callingModelBridgeInternal.setFeedOptionsMaxItemCount() and instead do the byPage() conversion?
public Mono<Void> readAllAsync(int expectedNumberOfDocuments) { return Mono.defer(() -> { while (true) { int totalItemRead = 0; FeedResponse<Document> response = null; do { FeedOptions options = new FeedOptions(); ModelBridgeInternal.setFeedOptionsContinuationToken(options, response != null ? response.getContinuationTo...
ModelBridgeInternal.setFeedOptionsContinuationToken(options, response != null ? response.getContinuationToken() : null);
public Mono<Void> readAllAsync(int expectedNumberOfDocuments) { return Mono.defer(() -> { while (true) { int totalItemRead = 0; FeedResponse<Document> response = null; do { FeedOptions options = new FeedOptions(); ModelBridgeInternal.setFeedOptionsContinuationToken(options, response != null ? response.getContinuationTo...
class Worker { private final static Logger logger = LoggerFactory.getLogger(Worker.class); private final AsyncDocumentClient client; private final String documentCollectionUri; private final Scheduler schedulerForBlockingWork; private final ExecutorService executor; public Worker(AsyncDocumentClient client, String data...
class Worker { private final static Logger logger = LoggerFactory.getLogger(Worker.class); private final AsyncDocumentClient client; private final String documentCollectionUri; private final Scheduler schedulerForBlockingWork; private final ExecutorService executor; public Worker(AsyncDocumentClient client, String data...
We cannot, because these ones use `AsyncDocumentClient` - which is an internal type. Public APIs `byPage()` are not available here. So that's why we used ModelBridgeInternal class. See this: https://github.com/Azure/azure-sdk-for-java/pull/10146/files/9c29922a7eea87190f77de4548325a4890364a9b#diff-6ca349d07cccd84853faf...
public Mono<Void> readAllAsync(int expectedNumberOfDocuments) { return Mono.defer(() -> { while (true) { int totalItemRead = 0; FeedResponse<Document> response = null; do { FeedOptions options = new FeedOptions(); ModelBridgeInternal.setFeedOptionsContinuationToken(options, response != null ? response.getContinuationTo...
ModelBridgeInternal.setFeedOptionsContinuationToken(options, response != null ? response.getContinuationToken() : null);
public Mono<Void> readAllAsync(int expectedNumberOfDocuments) { return Mono.defer(() -> { while (true) { int totalItemRead = 0; FeedResponse<Document> response = null; do { FeedOptions options = new FeedOptions(); ModelBridgeInternal.setFeedOptionsContinuationToken(options, response != null ? response.getContinuationTo...
class Worker { private final static Logger logger = LoggerFactory.getLogger(Worker.class); private final AsyncDocumentClient client; private final String documentCollectionUri; private final Scheduler schedulerForBlockingWork; private final ExecutorService executor; public Worker(AsyncDocumentClient client, String data...
class Worker { private final static Logger logger = LoggerFactory.getLogger(Worker.class); private final AsyncDocumentClient client; private final String documentCollectionUri; private final Scheduler schedulerForBlockingWork; private final ExecutorService executor; public Worker(AsyncDocumentClient client, String data...
understood
public Mono<Void> readAllAsync(int expectedNumberOfDocuments) { return Mono.defer(() -> { while (true) { int totalItemRead = 0; FeedResponse<Document> response = null; do { FeedOptions options = new FeedOptions(); ModelBridgeInternal.setFeedOptionsContinuationToken(options, response != null ? response.getContinuationTo...
ModelBridgeInternal.setFeedOptionsContinuationToken(options, response != null ? response.getContinuationToken() : null);
public Mono<Void> readAllAsync(int expectedNumberOfDocuments) { return Mono.defer(() -> { while (true) { int totalItemRead = 0; FeedResponse<Document> response = null; do { FeedOptions options = new FeedOptions(); ModelBridgeInternal.setFeedOptionsContinuationToken(options, response != null ? response.getContinuationTo...
class Worker { private final static Logger logger = LoggerFactory.getLogger(Worker.class); private final AsyncDocumentClient client; private final String documentCollectionUri; private final Scheduler schedulerForBlockingWork; private final ExecutorService executor; public Worker(AsyncDocumentClient client, String data...
class Worker { private final static Logger logger = LoggerFactory.getLogger(Worker.class); private final AsyncDocumentClient client; private final String documentCollectionUri; private final Scheduler schedulerForBlockingWork; private final ExecutorService executor; public Worker(AsyncDocumentClient client, String data...
This would be easier to understand if you do: ```java if (this.hidden != null) { this.retrievable = !this.hidden; } ``` Shouldn't the retrievable logic be done after setting the member variable? not before?
public Field setHidden(Boolean hidden) { retrievable = this.hidden == null ? null : !this.hidden; this.hidden = hidden; return this; }
retrievable = this.hidden == null ? null : !this.hidden;
public Field setHidden(Boolean hidden) { this.hidden = hidden; retrievable = this.hidden == null ? null : !this.hidden; return this; }
class Field { /* * The name of the field, which must be unique within the fields collection * of the index or parent field. */ @JsonProperty(value = "name", required = true) private String name; /* * The data type of the field. Possible values include: 'Edm.String', * 'Edm.Int32', 'Edm.Int64', 'Edm.Double', 'Edm.Boolea...
class Field { /* * The name of the field, which must be unique within the fields collection * of the index or parent field. */ @JsonProperty(value = "name", required = true) private String name; /* * The data type of the field. Possible values include: 'Edm.String', * 'Edm.Int32', 'Edm.Int64', 'Edm.Double', 'Edm.Boolea...
setHidden is the only entry to set `retrievable` field. The logic needs to change to ``` if (hidden != null) { this.retrievable = !hidden; } this.hidden = hidden; ``` Good catch
public Field setHidden(Boolean hidden) { retrievable = this.hidden == null ? null : !this.hidden; this.hidden = hidden; return this; }
retrievable = this.hidden == null ? null : !this.hidden;
public Field setHidden(Boolean hidden) { this.hidden = hidden; retrievable = this.hidden == null ? null : !this.hidden; return this; }
class Field { /* * The name of the field, which must be unique within the fields collection * of the index or parent field. */ @JsonProperty(value = "name", required = true) private String name; /* * The data type of the field. Possible values include: 'Edm.String', * 'Edm.Int32', 'Edm.Int64', 'Edm.Double', 'Edm.Boolea...
class Field { /* * The name of the field, which must be unique within the fields collection * of the index or parent field. */ @JsonProperty(value = "name", required = true) private String name; /* * The data type of the field. Possible values include: 'Edm.String', * 'Edm.Int32', 'Edm.Int64', 'Edm.Double', 'Edm.Boolea...
trainingPollOperationResponse -> recognizePollingOperation.
public void beginRecognizeCustomFormsFromUrl() { String analyzeFilePath = "{file_source_url}"; String modelId = "{model_id}"; formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(analyzeFilePath, modelId).subscribe( trainingPollOperationResponse -> trainingPollOperationResponse.getFinalResult().subscribe(recogniz...
trainingPollOperationResponse ->
public void beginRecognizeCustomFormsFromUrl() { String analyzeFilePath = "{file_source_url}"; String modelId = "{model_id}"; formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(analyzeFilePath, modelId).subscribe( recognizePollingOperation -> recognizePollingOperation.getFinalResult().subscribe(recognizedForms ...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
One line change is easy to do in transformer. :) I would like to switch to ``` this.hidden = hidden; retrievable = this.hidden == null ? null : !this.hidden; ```
public Field setHidden(Boolean hidden) { retrievable = this.hidden == null ? null : !this.hidden; this.hidden = hidden; return this; }
retrievable = this.hidden == null ? null : !this.hidden;
public Field setHidden(Boolean hidden) { this.hidden = hidden; retrievable = this.hidden == null ? null : !this.hidden; return this; }
class Field { /* * The name of the field, which must be unique within the fields collection * of the index or parent field. */ @JsonProperty(value = "name", required = true) private String name; /* * The data type of the field. Possible values include: 'Edm.String', * 'Edm.Int32', 'Edm.Int64', 'Edm.Double', 'Edm.Boolea...
class Field { /* * The name of the field, which must be unique within the fields collection * of the index or parent field. */ @JsonProperty(value = "name", required = true) private String name; /* * The data type of the field. Possible values include: 'Edm.String', * 'Edm.Int32', 'Edm.Int64', 'Edm.Double', 'Edm.Boolea...
"Model Type Id: --> Form type:
public void getCustomModel() { String modelId = "{model_id}"; formTrainingAsyncClient.getCustomModel(modelId).subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); customFormModel.getSubModels().forEac...
key, customFormModelField.getName(), customFormModelField.getAccuracy())));
public void getCustomModel() { String modelId = "{model_id}"; formTrainingAsyncClient.getCustomModel(modelId).subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); customFormModel.getSubModels().forEac...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
"Max number of models that can be trained for this account"
public void getAccountProperties() { formTrainingAsyncClient.getAccountProperties().subscribe(accountProperties -> { System.out.printf("Account properties limit: %s%n", accountProperties.getLimit()); System.out.printf("Account properties count: %d%n", accountProperties.getCount()); }); }
System.out.printf("Account properties limit: %s%n", accountProperties.getLimit());
public void getAccountProperties() { formTrainingAsyncClient.getAccountProperties().subscribe(accountProperties -> { System.out.printf("Max number of models that can be trained for this account: %s%n", accountProperties.getLimit()); System.out.printf("Current count of trained custom models: %d%n", accountProperties.get...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
Current count of trained custom models:
public void getAccountProperties() { formTrainingAsyncClient.getAccountProperties().subscribe(accountProperties -> { System.out.printf("Account properties limit: %s%n", accountProperties.getLimit()); System.out.printf("Account properties count: %d%n", accountProperties.getCount()); }); }
System.out.printf("Account properties count: %d%n", accountProperties.getCount());
public void getAccountProperties() { formTrainingAsyncClient.getAccountProperties().subscribe(accountProperties -> { System.out.printf("Max number of models that can be trained for this account: %s%n", accountProperties.getLimit()); System.out.printf("Current count of trained custom models: %d%n", accountProperties.get...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
No need to subscribe on void. just update this to formTrainingAsyncClient.deleteModel("{modelId}")
public void deleteModel() { String modelId = "{model_id}"; formTrainingAsyncClient.deleteModel(modelId).subscribe(val -> System.out.printf("Model ID = %s is deleted%n", modelId)); }
System.out.printf("Model ID = %s is deleted%n", modelId));
public void deleteModel() { String modelId = "{model_id}"; formTrainingAsyncClient.deleteModel(modelId).subscribe(val -> System.out.printf("Model Id: %s is deleted%n", modelId)); }
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
subscribe and print the response status
public void deleteModelWithResponse() { String modelId = "{model_id}"; formTrainingAsyncClient.deleteModelWithResponse(modelId).subscribe(val -> System.out.printf("Model ID = %s is deleted%n", modelId)); }
System.out.printf("Model ID = %s is deleted%n", modelId));
public void deleteModelWithResponse() { String modelId = "{model_id}"; formTrainingAsyncClient.deleteModelWithResponse(modelId).subscribe(response -> { System.out.printf("Response Status Code: %d.", response.getStatusCode()); System.out.printf("Model Id: %s is deleted%n", modelId); }); }
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
FYI, when app config do deletion, like deleting a configuration, we do return object to user. does method call trigger if without subscribe?
public void deleteModel() { String modelId = "{model_id}"; formTrainingAsyncClient.deleteModel(modelId).subscribe(val -> System.out.printf("Model ID = %s is deleted%n", modelId)); }
System.out.printf("Model ID = %s is deleted%n", modelId));
public void deleteModel() { String modelId = "{model_id}"; formTrainingAsyncClient.deleteModel(modelId).subscribe(val -> System.out.printf("Model Id: %s is deleted%n", modelId)); }
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
remove Id from the form type.
public void getCustomModel() { String modelId = "{model_id}"; formTrainingAsyncClient.getCustomModel(modelId).subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); customFormModel.getSubModels().forEac...
key, customFormModelField.getName(), customFormModelField.getAccuracy())));
public void getCustomModel() { String modelId = "{model_id}"; formTrainingAsyncClient.getCustomModel(modelId).subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); customFormModel.getSubModels().forEac...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
everywhere applicable.
public void beginRecognizeCustomFormsFromUrl() { String analyzeFilePath = "{file_source_url}"; String modelId = "{model_id}"; formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(analyzeFilePath, modelId).subscribe( trainingPollOperationResponse -> trainingPollOperationResponse.getFinalResult().subscribe(recogniz...
trainingPollOperationResponse ->
public void beginRecognizeCustomFormsFromUrl() { String analyzeFilePath = "{file_source_url}"; String modelId = "{model_id}"; formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(analyzeFilePath, modelId).subscribe( recognizePollingOperation -> recognizePollingOperation.getFinalResult().subscribe(recognizedForms ...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
remove `||` from all content print statements.
public void beginRecognizeContentFromUrl() { String sourceFilePath = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeContentFromUrl(sourceFilePath).subscribe( trainingPollOperationResponse -> trainingPollOperationResponse.getFinalResult().subscribe(layoutPageResults -> layoutPageResults.forEach(recognizedF...
System.out.printf("%s || ", recognizedTableCell.getText())));
public void beginRecognizeContentFromUrl() { String sourceFilePath = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeContentFromUrl(sourceFilePath).subscribe( recognizePollingOperation -> recognizePollingOperation.getFinalResult().subscribe(layoutPageResults -> layoutPageResults.forEach(recognizedForm -> {...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
delete these value lines. and just update the above line to >System.out.printf("Merchant Name: %s%n", usReceipt.getMerchantName().getFieldValue());
public void beginRecognizeReceiptsFromUrl() { String receiptUrl = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeReceiptsFromUrl(receiptUrl).subscribe(trainingPollOperationResponse -> { trainingPollOperationResponse.getFinalResult().subscribe(recognizedReceipts -> recognizedReceipts.forEach(recognizedRece...
System.out.printf("Merchant Name Value: %s%n", usReceipt.getMerchantName().getFieldValue());
public void beginRecognizeReceiptsFromUrl() { String receiptUrl = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeReceiptsFromUrl(receiptUrl).subscribe(recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(recognizedReceipts -> recognizedReceipts.forEach(recognizedReceipt -> {...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
applicable to all receipt recognize examples
public void beginRecognizeReceiptsFromUrl() { String receiptUrl = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeReceiptsFromUrl(receiptUrl).subscribe(trainingPollOperationResponse -> { trainingPollOperationResponse.getFinalResult().subscribe(recognizedReceipts -> recognizedReceipts.forEach(recognizedRece...
System.out.printf("Merchant Name Value: %s%n", usReceipt.getMerchantName().getFieldValue());
public void beginRecognizeReceiptsFromUrl() { String receiptUrl = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeReceiptsFromUrl(receiptUrl).subscribe(recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(recognizedReceipts -> recognizedReceipts.forEach(recognizedReceipt -> {...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
"Form Type Id" -> Form Type It is not an Id
public void getCustomModel() { String modelId = "{model_id}"; formTrainingAsyncClient.getCustomModel(modelId).subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); customFormModel.getSubModels().forEac...
key, customFormModelField.getName(), customFormModelField.getAccuracy())));
public void getCustomModel() { String modelId = "{model_id}"; formTrainingAsyncClient.getCustomModel(modelId).subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); customFormModel.getSubModels().forEac...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
Need to print merchant address and tax and phone number just to show various us receipt items.
public void beginRecognizeReceiptsFromUrl() { String receiptUrl = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeReceiptsFromUrl(receiptUrl).subscribe(recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(recognizedReceipts -> recognizedReceipts.forEach(recognizedReceipt -> {...
System.out.printf("Merchant Name: %s%n", usReceipt.getMerchantName().getFieldValue());
public void beginRecognizeReceiptsFromUrl() { String receiptUrl = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeReceiptsFromUrl(receiptUrl).subscribe(recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(recognizedReceipts -> recognizedReceipts.forEach(recognizedReceipt -> {...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
we need only the values , not so much name.
public void beginRecognizeReceiptsFromUrl() { String receiptUrl = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeReceiptsFromUrl(receiptUrl).subscribe(recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(recognizedReceipts -> recognizedReceipts.forEach(recognizedReceipt -> {...
System.out.printf("Merchant Name: %s%n", usReceipt.getMerchantName().getFieldValue());
public void beginRecognizeReceiptsFromUrl() { String receiptUrl = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeReceiptsFromUrl(receiptUrl).subscribe(recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(recognizedReceipts -> recognizedReceipts.forEach(recognizedReceipt -> {...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
class FormRecognizerAsyncClientJavaDocCodeSnippets { FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient(); /** * Code snippet for creating a {@link FormRecognizerAsyncClient} */ public void createFormRecognizerAsyncClient() { FormRecognizerAsyncClient formRecognizer...
print status code may be to show difference between with and without response?
public void getAccountPropertiesWithResponse() { formTrainingAsyncClient.getAccountPropertiesWithResponse().subscribe(response -> { AccountProperties accountProperties = response.getValue(); System.out.printf("Max number of models that can be trained for this account: %s%n", accountProperties.getLimit()); System.out.pr...
AccountProperties accountProperties = response.getValue();
public void getAccountPropertiesWithResponse() { formTrainingAsyncClient.getAccountPropertiesWithResponse().subscribe(response -> { System.out.printf("Response Status Code: %d.", response.getStatusCode()); AccountProperties accountProperties = response.getValue(); System.out.printf("Max number of models that can be tra...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
like delteModelWithResponse
public void getAccountPropertiesWithResponse() { formTrainingAsyncClient.getAccountPropertiesWithResponse().subscribe(response -> { AccountProperties accountProperties = response.getValue(); System.out.printf("Max number of models that can be trained for this account: %s%n", accountProperties.getLimit()); System.out.pr...
AccountProperties accountProperties = response.getValue();
public void getAccountPropertiesWithResponse() { formTrainingAsyncClient.getAccountPropertiesWithResponse().subscribe(response -> { System.out.printf("Response Status Code: %d.", response.getStatusCode()); AccountProperties accountProperties = response.getValue(); System.out.printf("Max number of models that can be tra...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
class FormTrainingAsyncClientJavaDocCodeSnippets { private FormTrainingAsyncClient formTrainingAsyncClient = new FormRecognizerClientBuilder().buildAsyncClient() .getFormTrainingAsyncClient(); /** * Code snippet for {@link FormTrainingAsyncClient} initialization */ public void formTrainingAsyncClientInInitialization() ...
I think it'd be best to have the forms also in the samples folder, doesn't look great going into the test folder
public static void main(String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_Key}")) .endpoint("https: .buildClient(); File analyzeFile = new File("../../test/resources/sample-files/Invoice_1.pdf"); byte[] fileContent = Files.readAllByt...
File analyzeFile = new File("../../test/resources/sample-files/Invoice_1.pdf");
public static void main(String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https: .buildClient(); File analyzeFile = new File("sample-forms/forms/Invoice_6.pdf"); IterableStream<RecognizedForm> formsWithLabeledModel...
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. */ private static void printFieldData(IterableStream<RecognizedForm> recognizedForms) {...
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. */ }
Differences between labeled and unlabeled might be more clear without decomposition. For example, I didn't print label data information for the labeled custom model, while I did for unlabeled
public static void main(String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_Key}")) .endpoint("https: .buildClient(); File analyzeFile = new File("../../test/resources/sample-files/Invoice_1.pdf"); byte[] fileContent = Files.readAllByt...
printFieldData(formsWithLabeledModel);
public static void main(String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https: .buildClient(); File analyzeFile = new File("sample-forms/forms/Invoice_6.pdf"); IterableStream<RecognizedForm> formsWithLabeledModel...
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. */ private static void printFieldData(IterableStream<RecognizedForm> recognizedForms) {...
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 thought java had automatic content type detection. If so, can you not pass the content type since that's what most users will be doing
public static void main(final String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https: .buildClient(); File sourceFile = new File("../../test/resources/sample-files/layout1.jpg"); byte[] fileContent = Files.readAll...
client.beginRecognizeContent(targetStream, sourceFile.length(), FormContentType.IMAGE_JPEG);
public static void main(final String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https: .buildClient(); File sourceFile = new File("/sample-forms/forms/layout1.jpg"); byte[] fileContent = Files.readAllBytes(sourceFi...
class RecognizeContent { /** * 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 RecognizeContent { /** * 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. */ }
Confused why this file is empty
public static void main(final String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https: .buildClient(); File sourceFile = new File(""); byte[] fileContent = Files.readAllBytes(sourceFile.toPath()); InputStream targe...
File sourceFile = new File("");
public static void main(final String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https: .buildClient(); File sourceFile = new File("/sample-forms/receipts/contoso-allinone.jpg"); byte[] fileContent = Files.readAllBy...
class RecognizeReceipts { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. * @throws IOException from reading file. */ }
class RecognizeReceipts { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. * @throws IOException from reading file. */ }
I know we said Java might diverge on this (doing file for sync, url for async), but I think that because you've added a recognizeReceipts and a recognizeReceipts FromURL, you can have the other sync and async functions call the files functions
public static void main(final String[] args) { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https: .buildAsyncClient(); PollerFlux<OperationResult, IterableStream<FormPage>> recognizeLayoutPoller = client.beginRecognizeContentFromUrl("file...
client.beginRecognizeContentFromUrl("file_source_url");
public static void main(final String[] args) { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https: .buildAsyncClient(); PollerFlux<OperationResult, IterableStream<FormPage>> recognizeLayoutPoller = client.beginRecognizeContentFromUrl("http...
class RecognizeContentAsync { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
class RecognizeContentAsync { /** * Main method to invoke this demo. * * @param args Unused. Arguments to the program. */ }
Considering the samples might get in before the feature would like to keep it this way and maybe consider updating once we get the feature in.
public static void main(final String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https: .buildClient(); File sourceFile = new File("../../test/resources/sample-files/layout1.jpg"); byte[] fileContent = Files.readAll...
client.beginRecognizeContent(targetStream, sourceFile.length(), FormContentType.IMAGE_JPEG);
public static void main(final String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https: .buildClient(); File sourceFile = new File("/sample-forms/forms/layout1.jpg"); byte[] fileContent = Files.readAllBytes(sourceFi...
class RecognizeContent { /** * 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 RecognizeContent { /** * 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. */ }
@samvaity don't forget to update it without real credential
public static void main(String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("48c9ec5b1c444c899770946defc486c4")) .endpoint("https: .buildClient(); File analyzeFile = new File("../../test/resources/sample-files/Invoice_6.pdf"); System.out.pri...
.apiKey(new AzureKeyCredential("48c9ec5b1c444c899770946defc486c4"))
public static void main(String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https: .buildClient(); File analyzeFile = new File("sample-forms/forms/Invoice_6.pdf"); IterableStream<RecognizedForm> formsWithLabeledModel...
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. */ private static void printFieldData(IterableStream<RecognizedForm> recognizedForms) {...
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. */ }
We don't need to support multiple tracer implementation. Refer here - https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/TracerProvider.java#L40
public Context startSpan(String methodName, String databaseId, String endpoint, Context context) { Context local = Objects.requireNonNull(context, "'context' cannot be null."); for (Tracer tracer : tracers) { local = tracer.start(methodName, local); if (databaseId != null) { tracer.setAttribute(TracerProvider.DB_INSTAN...
for (Tracer tracer : tracers) {
public Context startSpan(String methodName, String databaseId, String endpoint, Context context) { Context local = Objects.requireNonNull(context, "'context' cannot be null."); local = local.addData(AZ_TRACING_NAMESPACE_KEY, RESOURCE_PROVIDER_NAME); local = tracer.start(methodName, local); if (databaseId != null) { tra...
class TracerProvider { private final List<Tracer> tracers = new ArrayList<>(); private final boolean isEnabled; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; publi...
class TracerProvider { private Tracer tracer; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; public static final String DB_STATEMENT = "db.statement"; public static...
AZ_TRACING_NAMESPACE_KEY needs to be passed using the context as the tracer expects it in the context [here](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-tracing-opentelemetry/src/main/java/com/azure/core/tracing/opentelemetry/OpenTelemetryTracer.java#L52) and aligns with other SDK behavi...
public Context startSpan(String methodName, String databaseId, String endpoint, Context context) { Context local = Objects.requireNonNull(context, "'context' cannot be null."); for (Tracer tracer : tracers) { local = tracer.start(methodName, local); if (databaseId != null) { tracer.setAttribute(TracerProvider.DB_INSTAN...
tracer.setAttribute(AZ_TRACING_NAMESPACE_KEY, RESOURCE_PROVIDER_NAME, local);
public Context startSpan(String methodName, String databaseId, String endpoint, Context context) { Context local = Objects.requireNonNull(context, "'context' cannot be null."); local = local.addData(AZ_TRACING_NAMESPACE_KEY, RESOURCE_PROVIDER_NAME); local = tracer.start(methodName, local); if (databaseId != null) { tra...
class TracerProvider { private final List<Tracer> tracers = new ArrayList<>(); private final boolean isEnabled; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; publi...
class TracerProvider { private Tracer tracer; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; public static final String DB_STATEMENT = "db.statement"; public static...
do we think this is a good idea? especially since `Throwable.printStackTrace()` isn't thread-safe and could give out confusing logs/statements? cc: @srnagar
private void end(int statusCode, Throwable throwable, Context context) { for (Tracer tracer : tracers) { if (throwable != null) { tracer.setAttribute(TracerProvider.ERROR_MSG, throwable.getMessage(), context); tracer.setAttribute(TracerProvider.ERROR_TYPE, throwable.getClass().getName(), context); StringWriter errorSta...
throwable.printStackTrace(new PrintWriter(errorStack));
private void end(int statusCode, Throwable throwable, Context context) { if (throwable != null) { tracer.setAttribute(TracerProvider.ERROR_MSG, throwable.getMessage(), context); tracer.setAttribute(TracerProvider.ERROR_TYPE, throwable.getClass().getName(), context); } tracer.end(statusCode, throwable, context); }
class TracerProvider { private final List<Tracer> tracers = new ArrayList<>(); private final boolean isEnabled; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; publi...
class TracerProvider { private Tracer tracer; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; public static final String DB_STATEMENT = "db.statement"; public static...
use `StepVerifier` instead of `block` for testing async calls?
public void cosmosAsyncClient() { TracerProvider tracer = Mockito.spy(new TracerProvider(ServiceLoader.load(Tracer.class))); ReflectionUtils.setTracerProvider(client, tracer); client.createDatabaseIfNotExists(cosmosAsyncDatabase.getId()).block(); Mockito.verify(tracer, Mockito.times(1)).startSpan(Matchers.anyString(), ...
client.createDatabaseIfNotExists(cosmosAsyncDatabase.getId()).block();
public void cosmosAsyncClient() { TracerProvider tracer = Mockito.spy(new TracerProvider(ServiceLoader.load(Tracer.class))); ReflectionUtils.setTracerProvider(client, tracer); client.createDatabaseIfNotExists(cosmosAsyncDatabase.getId()).block(); Mockito.verify(tracer, Mockito.times(1)).startSpan(Matchers.anyString(), ...
class CosmosTracerTest extends TestSuiteBase { private static final String ITEM_ID = "tracerDoc"; CosmosAsyncClient client; CosmosAsyncDatabase cosmosAsyncDatabase; CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) public void beforeClass() { client = new CosmosClie...
class CosmosTracerTest extends TestSuiteBase { private static final String ITEM_ID = "tracerDoc"; CosmosAsyncClient client; CosmosAsyncDatabase cosmosAsyncDatabase; CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) public void beforeClass() { client = new CosmosClie...
Rather than any string could we validate the span names and attributes being set on the span?
public void cosmosAsyncClient() { TracerProvider tracer = Mockito.spy(new TracerProvider(ServiceLoader.load(Tracer.class))); ReflectionUtils.setTracerProvider(client, tracer); client.createDatabaseIfNotExists(cosmosAsyncDatabase.getId()).block(); Mockito.verify(tracer, Mockito.times(1)).startSpan(Matchers.anyString(), ...
Mockito.verify(tracer, Mockito.times(1)).startSpan(Matchers.anyString(), Matchers.anyString(),
public void cosmosAsyncClient() { TracerProvider tracer = Mockito.spy(new TracerProvider(ServiceLoader.load(Tracer.class))); ReflectionUtils.setTracerProvider(client, tracer); client.createDatabaseIfNotExists(cosmosAsyncDatabase.getId()).block(); Mockito.verify(tracer, Mockito.times(1)).startSpan(Matchers.anyString(), ...
class CosmosTracerTest extends TestSuiteBase { private static final String ITEM_ID = "tracerDoc"; CosmosAsyncClient client; CosmosAsyncDatabase cosmosAsyncDatabase; CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) public void beforeClass() { client = new CosmosClie...
class CosmosTracerTest extends TestSuiteBase { private static final String ITEM_ID = "tracerDoc"; CosmosAsyncClient client; CosmosAsyncDatabase cosmosAsyncDatabase; CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) public void beforeClass() { client = new CosmosClie...
Should consider adding tests for `TracerProvider`.
protected static void truncateCollection(CosmosAsyncContainer cosmosContainer) { CosmosContainerProperties cosmosContainerProperties = cosmosContainer.read().block().getProperties(); String cosmosContainerId = cosmosContainerProperties.getId(); logger.info("Truncating collection {} ...", cosmosContainerId); List<String...
}
protected static void truncateCollection(CosmosAsyncContainer cosmosContainer) { CosmosContainerProperties cosmosContainerProperties = cosmosContainer.read().block().getProperties(); String cosmosContainerId = cosmosContainerProperties.getId(); logger.info("Truncating collection {} ...", cosmosContainerId); List<String...
class DatabaseManagerImpl implements CosmosDatabaseForTest.DatabaseManager { public static DatabaseManagerImpl getInstance(CosmosAsyncClient client) { return new DatabaseManagerImpl(client); } private final CosmosAsyncClient client; private DatabaseManagerImpl(CosmosAsyncClient client) { this.client = client; } @Overri...
class DatabaseManagerImpl implements CosmosDatabaseForTest.DatabaseManager { public static DatabaseManagerImpl getInstance(CosmosAsyncClient client) { return new DatabaseManagerImpl(client); } private final CosmosAsyncClient client; private DatabaseManagerImpl(CosmosAsyncClient client) { this.client = client; } @Overri...
Also, consider adding a nesting call example to validate the behavior of spans.
protected static void truncateCollection(CosmosAsyncContainer cosmosContainer) { CosmosContainerProperties cosmosContainerProperties = cosmosContainer.read().block().getProperties(); String cosmosContainerId = cosmosContainerProperties.getId(); logger.info("Truncating collection {} ...", cosmosContainerId); List<String...
}
protected static void truncateCollection(CosmosAsyncContainer cosmosContainer) { CosmosContainerProperties cosmosContainerProperties = cosmosContainer.read().block().getProperties(); String cosmosContainerId = cosmosContainerProperties.getId(); logger.info("Truncating collection {} ...", cosmosContainerId); List<String...
class DatabaseManagerImpl implements CosmosDatabaseForTest.DatabaseManager { public static DatabaseManagerImpl getInstance(CosmosAsyncClient client) { return new DatabaseManagerImpl(client); } private final CosmosAsyncClient client; private DatabaseManagerImpl(CosmosAsyncClient client) { this.client = client; } @Overri...
class DatabaseManagerImpl implements CosmosDatabaseForTest.DatabaseManager { public static DatabaseManagerImpl getInstance(CosmosAsyncClient client) { return new DatabaseManagerImpl(client); } private final CosmosAsyncClient client; private DatabaseManagerImpl(CosmosAsyncClient client) { this.client = client; } @Overri...
I don't think we should have the entire stacktrace in tracing. It's important to capture that there was an error but the stracktrace is likely not that useful. Stacktrace should be available in logs, if that's necessary. It's also a security issue to capture stacktrace since the user cannot control or turn it off.
private void end(int statusCode, Throwable throwable, Context context) { for (Tracer tracer : tracers) { if (throwable != null) { tracer.setAttribute(TracerProvider.ERROR_MSG, throwable.getMessage(), context); tracer.setAttribute(TracerProvider.ERROR_TYPE, throwable.getClass().getName(), context); StringWriter errorSta...
throwable.printStackTrace(new PrintWriter(errorStack));
private void end(int statusCode, Throwable throwable, Context context) { if (throwable != null) { tracer.setAttribute(TracerProvider.ERROR_MSG, throwable.getMessage(), context); tracer.setAttribute(TracerProvider.ERROR_TYPE, throwable.getClass().getName(), context); } tracer.end(statusCode, throwable, context); }
class TracerProvider { private final List<Tracer> tracers = new ArrayList<>(); private final boolean isEnabled; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; publi...
class TracerProvider { private Tracer tracer; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; public static final String DB_STATEMENT = "db.statement"; public static...
This is cover by start span count assert , test will fail if there is nesting . Will add explicit test in next pr covering event
protected static void truncateCollection(CosmosAsyncContainer cosmosContainer) { CosmosContainerProperties cosmosContainerProperties = cosmosContainer.read().block().getProperties(); String cosmosContainerId = cosmosContainerProperties.getId(); logger.info("Truncating collection {} ...", cosmosContainerId); List<String...
}
protected static void truncateCollection(CosmosAsyncContainer cosmosContainer) { CosmosContainerProperties cosmosContainerProperties = cosmosContainer.read().block().getProperties(); String cosmosContainerId = cosmosContainerProperties.getId(); logger.info("Truncating collection {} ...", cosmosContainerId); List<String...
class DatabaseManagerImpl implements CosmosDatabaseForTest.DatabaseManager { public static DatabaseManagerImpl getInstance(CosmosAsyncClient client) { return new DatabaseManagerImpl(client); } private final CosmosAsyncClient client; private DatabaseManagerImpl(CosmosAsyncClient client) { this.client = client; } @Overri...
class DatabaseManagerImpl implements CosmosDatabaseForTest.DatabaseManager { public static DatabaseManagerImpl getInstance(CosmosAsyncClient client) { return new DatabaseManagerImpl(client); } private final CosmosAsyncClient client; private DatabaseManagerImpl(CosmosAsyncClient client) { this.client = client; } @Overri...
Will address all testing format comment in next tracer event pr as discussed offline
public void cosmosAsyncClient() { TracerProvider tracer = Mockito.spy(new TracerProvider(ServiceLoader.load(Tracer.class))); ReflectionUtils.setTracerProvider(client, tracer); client.createDatabaseIfNotExists(cosmosAsyncDatabase.getId()).block(); Mockito.verify(tracer, Mockito.times(1)).startSpan(Matchers.anyString(), ...
Mockito.verify(tracer, Mockito.times(1)).startSpan(Matchers.anyString(), Matchers.anyString(),
public void cosmosAsyncClient() { TracerProvider tracer = Mockito.spy(new TracerProvider(ServiceLoader.load(Tracer.class))); ReflectionUtils.setTracerProvider(client, tracer); client.createDatabaseIfNotExists(cosmosAsyncDatabase.getId()).block(); Mockito.verify(tracer, Mockito.times(1)).startSpan(Matchers.anyString(), ...
class CosmosTracerTest extends TestSuiteBase { private static final String ITEM_ID = "tracerDoc"; CosmosAsyncClient client; CosmosAsyncDatabase cosmosAsyncDatabase; CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) public void beforeClass() { client = new CosmosClie...
class CosmosTracerTest extends TestSuiteBase { private static final String ITEM_ID = "tracerDoc"; CosmosAsyncClient client; CosmosAsyncDatabase cosmosAsyncDatabase; CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) public void beforeClass() { client = new CosmosClie...
Will address testing format comment in next tracer event pr as discussed offline
public void cosmosAsyncClient() { TracerProvider tracer = Mockito.spy(new TracerProvider(ServiceLoader.load(Tracer.class))); ReflectionUtils.setTracerProvider(client, tracer); client.createDatabaseIfNotExists(cosmosAsyncDatabase.getId()).block(); Mockito.verify(tracer, Mockito.times(1)).startSpan(Matchers.anyString(), ...
client.createDatabaseIfNotExists(cosmosAsyncDatabase.getId()).block();
public void cosmosAsyncClient() { TracerProvider tracer = Mockito.spy(new TracerProvider(ServiceLoader.load(Tracer.class))); ReflectionUtils.setTracerProvider(client, tracer); client.createDatabaseIfNotExists(cosmosAsyncDatabase.getId()).block(); Mockito.verify(tracer, Mockito.times(1)).startSpan(Matchers.anyString(), ...
class CosmosTracerTest extends TestSuiteBase { private static final String ITEM_ID = "tracerDoc"; CosmosAsyncClient client; CosmosAsyncDatabase cosmosAsyncDatabase; CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) public void beforeClass() { client = new CosmosClie...
class CosmosTracerTest extends TestSuiteBase { private static final String ITEM_ID = "tracerDoc"; CosmosAsyncClient client; CosmosAsyncDatabase cosmosAsyncDatabase; CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) public void beforeClass() { client = new CosmosClie...
removed setting AZ_TRACING_NAMESPACE_KEY explicitly on tracer
public Context startSpan(String methodName, String databaseId, String endpoint, Context context) { Context local = Objects.requireNonNull(context, "'context' cannot be null."); for (Tracer tracer : tracers) { local = tracer.start(methodName, local); if (databaseId != null) { tracer.setAttribute(TracerProvider.DB_INSTAN...
tracer.setAttribute(AZ_TRACING_NAMESPACE_KEY, RESOURCE_PROVIDER_NAME, local);
public Context startSpan(String methodName, String databaseId, String endpoint, Context context) { Context local = Objects.requireNonNull(context, "'context' cannot be null."); local = local.addData(AZ_TRACING_NAMESPACE_KEY, RESOURCE_PROVIDER_NAME); local = tracer.start(methodName, local); if (databaseId != null) { tra...
class TracerProvider { private final List<Tracer> tracers = new ArrayList<>(); private final boolean isEnabled; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; publi...
class TracerProvider { private Tracer tracer; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; public static final String DB_STATEMENT = "db.statement"; public static...
done
public Context startSpan(String methodName, String databaseId, String endpoint, Context context) { Context local = Objects.requireNonNull(context, "'context' cannot be null."); for (Tracer tracer : tracers) { local = tracer.start(methodName, local); if (databaseId != null) { tracer.setAttribute(TracerProvider.DB_INSTAN...
for (Tracer tracer : tracers) {
public Context startSpan(String methodName, String databaseId, String endpoint, Context context) { Context local = Objects.requireNonNull(context, "'context' cannot be null."); local = local.addData(AZ_TRACING_NAMESPACE_KEY, RESOURCE_PROVIDER_NAME); local = tracer.start(methodName, local); if (databaseId != null) { tra...
class TracerProvider { private final List<Tracer> tracers = new ArrayList<>(); private final boolean isEnabled; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; publi...
class TracerProvider { private Tracer tracer; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; public static final String DB_STATEMENT = "db.statement"; public static...
As discussed keeping it the same i.e. AZ_TRACING_NAMESPACE_KEY on attributes, user will get extra warning log if he don't pass this. Will revisit it again in next tracing PR
public Context startSpan(String methodName, String databaseId, String endpoint, Context context) { Context local = Objects.requireNonNull(context, "'context' cannot be null."); for (Tracer tracer : tracers) { local = tracer.start(methodName, local); if (databaseId != null) { tracer.setAttribute(TracerProvider.DB_INSTAN...
tracer.setAttribute(AZ_TRACING_NAMESPACE_KEY, RESOURCE_PROVIDER_NAME, local);
public Context startSpan(String methodName, String databaseId, String endpoint, Context context) { Context local = Objects.requireNonNull(context, "'context' cannot be null."); local = local.addData(AZ_TRACING_NAMESPACE_KEY, RESOURCE_PROVIDER_NAME); local = tracer.start(methodName, local); if (databaseId != null) { tra...
class TracerProvider { private final List<Tracer> tracers = new ArrayList<>(); private final boolean isEnabled; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; publi...
class TracerProvider { private Tracer tracer; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; public static final String DB_STATEMENT = "db.statement"; public static...
Removed the error stacktrace
private void end(int statusCode, Throwable throwable, Context context) { for (Tracer tracer : tracers) { if (throwable != null) { tracer.setAttribute(TracerProvider.ERROR_MSG, throwable.getMessage(), context); tracer.setAttribute(TracerProvider.ERROR_TYPE, throwable.getClass().getName(), context); StringWriter errorSta...
throwable.printStackTrace(new PrintWriter(errorStack));
private void end(int statusCode, Throwable throwable, Context context) { if (throwable != null) { tracer.setAttribute(TracerProvider.ERROR_MSG, throwable.getMessage(), context); tracer.setAttribute(TracerProvider.ERROR_TYPE, throwable.getClass().getName(), context); } tracer.end(statusCode, throwable, context); }
class TracerProvider { private final List<Tracer> tracers = new ArrayList<>(); private final boolean isEnabled; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; publi...
class TracerProvider { private Tracer tracer; public final static String DB_TYPE_VALUE = "Cosmos"; public final static String DB_TYPE = "db.type"; public final static String DB_INSTANCE = "db.instance"; public final static String DB_URL = "db.url"; public static final String DB_STATEMENT = "db.statement"; public static...
These would be a good test cases to include as well. `Arguments.arguments(new PercentEscaper( "ह", false), "ह", "ह")` `new PercentEscaper(" ", true); // this should throw exception`
private static Stream<Arguments> escapeSupplier() { PercentEscaper defaultEscaper = new PercentEscaper(null, false); return Stream.of( Arguments.arguments(defaultEscaper, "$", "%24"), Arguments.arguments(defaultEscaper, "¢", "%C2%A2"), Arguments.arguments(defaultEscaper, "ह", "%E0%A4%B9"), Arguments.arguments(defaultEs...
Arguments.arguments(new PercentEscaper("$", false), "$", "$")
private static Stream<Arguments> escapeSupplier() { PercentEscaper defaultEscaper = new PercentEscaper(null, false); return Stream.of( Arguments.arguments(defaultEscaper, null, null), Arguments.arguments(defaultEscaper, "", ""), Arguments.arguments(defaultEscaper, "$", "%24"), Arguments.arguments(defaultEscaper, "¢", "...
class PercentEscaperTests { @ParameterizedTest @MethodSource("escapeSupplier") public void escape(PercentEscaper escaper, String original, String expected) { assertEquals(expected, escaper.escape(original)); } }
class PercentEscaperTests { /** * Tests that using {@code ' '} as a safe character and treating {@code ' '} as {@code '+'} is an illegal * configuration. */ @Test public void cannotUseSpaceAsPlusAndSpaceAsSafeCharacter() { assertThrows(IllegalArgumentException.class, () -> new PercentEscaper(" ", true)); } /** * Tests ...
This is a semantic breaking change for users as it now encodes strings differently and requires minor version bump.
private static Stream<Arguments> querySubstitutionSupplier() throws NoSuchMethodException { Class<QuerySubstitutionMethods> clazz = QuerySubstitutionMethods.class; Method substitution = clazz.getDeclaredMethod("substitutions", String.class, boolean.class); Method encodedSubstitution = clazz.getDeclaredMethod("encodedSu...
Arguments.of(substitution, toObjectArray("{sub1}", false), createExpectedParameters("%7Bsub1%7D", false)),
private static Stream<Arguments> querySubstitutionSupplier() throws NoSuchMethodException { Class<QuerySubstitutionMethods> clazz = QuerySubstitutionMethods.class; Method substitution = clazz.getDeclaredMethod("substitutions", String.class, boolean.class); Method encodedSubstitution = clazz.getDeclaredMethod("encodedSu...
class SwaggerMethodParserTests { interface OperationMethods { void noMethod(); @Get("test") void getMethod(); @Put("test") void putMethod(); @Head("test") void headMethod(); @Delete("test") void deleteMethod(); @Post("test") void postMethod(); @Patch("test") void patchMethod(); } @Test public void noHttpMethodAnnotatio...
class SwaggerMethodParserTests { interface OperationMethods { void noMethod(); @Get("test") void getMethod(); @Put("test") void putMethod(); @Head("test") void headMethod(); @Delete("test") void deleteMethod(); @Post("test") void postMethod(); @Patch("test") void patchMethod(); } @Test public void noHttpMethodAnnotatio...
PercentEscaper is package private with public static instance available, shouldn't see these inputs, can add tests though.
private static Stream<Arguments> escapeSupplier() { PercentEscaper defaultEscaper = new PercentEscaper(null, false); return Stream.of( Arguments.arguments(defaultEscaper, "$", "%24"), Arguments.arguments(defaultEscaper, "¢", "%C2%A2"), Arguments.arguments(defaultEscaper, "ह", "%E0%A4%B9"), Arguments.arguments(defaultEs...
Arguments.arguments(new PercentEscaper("$", false), "$", "$")
private static Stream<Arguments> escapeSupplier() { PercentEscaper defaultEscaper = new PercentEscaper(null, false); return Stream.of( Arguments.arguments(defaultEscaper, null, null), Arguments.arguments(defaultEscaper, "", ""), Arguments.arguments(defaultEscaper, "$", "%24"), Arguments.arguments(defaultEscaper, "¢", "...
class PercentEscaperTests { @ParameterizedTest @MethodSource("escapeSupplier") public void escape(PercentEscaper escaper, String original, String expected) { assertEquals(expected, escaper.escape(original)); } }
class PercentEscaperTests { /** * Tests that using {@code ' '} as a safe character and treating {@code ' '} as {@code '+'} is an illegal * configuration. */ @Test public void cannotUseSpaceAsPlusAndSpaceAsSafeCharacter() { assertThrows(IllegalArgumentException.class, () -> new PercentEscaper(" ", true)); } /** * Tests ...
I believe hex characters should be invariant on casing, I just copied the hex array creation from another of our classes and it used uppercase.
private static Stream<Arguments> querySubstitutionSupplier() throws NoSuchMethodException { Class<QuerySubstitutionMethods> clazz = QuerySubstitutionMethods.class; Method substitution = clazz.getDeclaredMethod("substitutions", String.class, boolean.class); Method encodedSubstitution = clazz.getDeclaredMethod("encodedSu...
Arguments.of(substitution, toObjectArray("{sub1}", false), createExpectedParameters("%7Bsub1%7D", false)),
private static Stream<Arguments> querySubstitutionSupplier() throws NoSuchMethodException { Class<QuerySubstitutionMethods> clazz = QuerySubstitutionMethods.class; Method substitution = clazz.getDeclaredMethod("substitutions", String.class, boolean.class); Method encodedSubstitution = clazz.getDeclaredMethod("encodedSu...
class SwaggerMethodParserTests { interface OperationMethods { void noMethod(); @Get("test") void getMethod(); @Put("test") void putMethod(); @Head("test") void headMethod(); @Delete("test") void deleteMethod(); @Post("test") void postMethod(); @Patch("test") void patchMethod(); } @Test public void noHttpMethodAnnotatio...
class SwaggerMethodParserTests { interface OperationMethods { void noMethod(); @Get("test") void getMethod(); @Put("test") void putMethod(); @Head("test") void headMethod(); @Delete("test") void deleteMethod(); @Post("test") void postMethod(); @Patch("test") void patchMethod(); } @Test public void noHttpMethodAnnotatio...
Added
private static Stream<Arguments> escapeSupplier() { PercentEscaper defaultEscaper = new PercentEscaper(null, false); return Stream.of( Arguments.arguments(defaultEscaper, "$", "%24"), Arguments.arguments(defaultEscaper, "¢", "%C2%A2"), Arguments.arguments(defaultEscaper, "ह", "%E0%A4%B9"), Arguments.arguments(defaultEs...
Arguments.arguments(new PercentEscaper("$", false), "$", "$")
private static Stream<Arguments> escapeSupplier() { PercentEscaper defaultEscaper = new PercentEscaper(null, false); return Stream.of( Arguments.arguments(defaultEscaper, null, null), Arguments.arguments(defaultEscaper, "", ""), Arguments.arguments(defaultEscaper, "$", "%24"), Arguments.arguments(defaultEscaper, "¢", "...
class PercentEscaperTests { @ParameterizedTest @MethodSource("escapeSupplier") public void escape(PercentEscaper escaper, String original, String expected) { assertEquals(expected, escaper.escape(original)); } }
class PercentEscaperTests { /** * Tests that using {@code ' '} as a safe character and treating {@code ' '} as {@code '+'} is an illegal * configuration. */ @Test public void cannotUseSpaceAsPlusAndSpaceAsSafeCharacter() { assertThrows(IllegalArgumentException.class, () -> new PercentEscaper(" ", true)); } /** * Tests ...
Why are you chaining.`then()`? The send operation already returns a mono void.
public Mono<Void> send(Iterable<ServiceBusMessage> messages) { Objects.requireNonNull(messages, "'messages' cannot be null."); return createBatch().flatMap(messageBatch -> { messages.forEach(serviceBusMessage -> messageBatch.tryAdd(serviceBusMessage)); return send(messageBatch); }).then(); }
}).then();
public Mono<Void> send(Iterable<ServiceBusMessage> messages) { if (Objects.isNull(messages)) { return monoError(logger, new NullPointerException("'messages' cannot be null.")); } return createBatch().flatMap(messageBatch -> { messages.forEach(message -> messageBatch.tryAdd(message)); return send(messageBatch); }); }
class ServiceBusSenderAsyncClient implements AutoCloseable { /** * The default maximum allowable size, in bytes, for a batch to be sent. */ static final int MAX_MESSAGE_LENGTH_BYTES = 256 * 1024; private static final CreateBatchOptions DEFAULT_BATCH_OPTIONS = new CreateBatchOptions(); private final ClientLogger logger...
class ServiceBusSenderAsyncClient implements AutoCloseable { /** * The default maximum allowable size, in bytes, for a batch to be sent. */ static final int MAX_MESSAGE_LENGTH_BYTES = 256 * 1024; private static final CreateBatchOptions DEFAULT_BATCH_OPTIONS = new CreateBatchOptions(); private final ClientLogger logger...
Should we remove "either of them" since the list of credentials we try can be more than 2?
public Mono<AccessToken> getToken(TokenRequestContext request) { AtomicReference<Throwable> cause = new AtomicReference<>(); List<CredentialUnavailableException> exceptions = new ArrayList<>(4); return Flux.fromIterable(credentials) .flatMap(p -> p.getToken(request).onErrorResume(CredentialUnavailableException.class, t...
+ " environment for either of them"
public Mono<AccessToken> getToken(TokenRequestContext request) { List<CredentialUnavailableException> exceptions = new ArrayList<>(4); return Flux.fromIterable(credentials) .flatMap(p -> p.getToken(request).onErrorResume(CredentialUnavailableException.class, t -> { exceptions.add(t); return Mono.empty(); }), 1) .next()...
class ChainedTokenCredential implements TokenCredential { private final Deque<TokenCredential> credentials; /** * Create an instance of chained token credential that aggregates a list of token * credentials. */ ChainedTokenCredential(Deque<TokenCredential> credentials) { this.credentials = credentials; } @Override }
class ChainedTokenCredential implements TokenCredential { private final Deque<TokenCredential> credentials; /** * Create an instance of chained token credential that aggregates a list of token * credentials. */ ChainedTokenCredential(Deque<TokenCredential> credentials) { this.credentials = credentials; } @Override }
nit: don't need to specify concurrency as 1 for flatmap. It's 1 by default.
public Mono<AccessToken> getToken(TokenRequestContext request) { AtomicReference<Throwable> cause = new AtomicReference<>(); List<CredentialUnavailableException> exceptions = new ArrayList<>(4); return Flux.fromIterable(credentials) .flatMap(p -> p.getToken(request).onErrorResume(CredentialUnavailableException.class, t...
}), 1)
public Mono<AccessToken> getToken(TokenRequestContext request) { List<CredentialUnavailableException> exceptions = new ArrayList<>(4); return Flux.fromIterable(credentials) .flatMap(p -> p.getToken(request).onErrorResume(CredentialUnavailableException.class, t -> { exceptions.add(t); return Mono.empty(); }), 1) .next()...
class ChainedTokenCredential implements TokenCredential { private final Deque<TokenCredential> credentials; /** * Create an instance of chained token credential that aggregates a list of token * credentials. */ ChainedTokenCredential(Deque<TokenCredential> credentials) { this.credentials = credentials; } @Override }
class ChainedTokenCredential implements TokenCredential { private final Deque<TokenCredential> credentials; /** * Create an instance of chained token credential that aggregates a list of token * credentials. */ ChainedTokenCredential(Deque<TokenCredential> credentials) { this.credentials = credentials; } @Override }
That's not true. Default concurrency is computed via: Math.max(16, Integer.parseInt(System.getProperty("reactor.bufferSize.small", "256")));
public Mono<AccessToken> getToken(TokenRequestContext request) { AtomicReference<Throwable> cause = new AtomicReference<>(); List<CredentialUnavailableException> exceptions = new ArrayList<>(4); return Flux.fromIterable(credentials) .flatMap(p -> p.getToken(request).onErrorResume(CredentialUnavailableException.class, t...
}), 1)
public Mono<AccessToken> getToken(TokenRequestContext request) { List<CredentialUnavailableException> exceptions = new ArrayList<>(4); return Flux.fromIterable(credentials) .flatMap(p -> p.getToken(request).onErrorResume(CredentialUnavailableException.class, t -> { exceptions.add(t); return Mono.empty(); }), 1) .next()...
class ChainedTokenCredential implements TokenCredential { private final Deque<TokenCredential> credentials; /** * Create an instance of chained token credential that aggregates a list of token * credentials. */ ChainedTokenCredential(Deque<TokenCredential> credentials) { this.credentials = credentials; } @Override }
class ChainedTokenCredential implements TokenCredential { private final Deque<TokenCredential> credentials; /** * Create an instance of chained token credential that aggregates a list of token * credentials. */ ChainedTokenCredential(Deque<TokenCredential> credentials) { this.credentials = credentials; } @Override }
```suggestion System.out.printf("HttpClient is %s; Service Version is %s", httpClient, serviceVersion); ```
static Stream<Arguments> getTestParameters() { List<Arguments> argumentsList = new ArrayList<>(); getHttpClients() .forEach(httpClient -> { Arrays.stream(CertificateServiceVersion.values()).filter( CertificateClientTestBase::shouldServiceVersionBeTested) .forEach(serviceVersion -> { argumentsList.add(Arguments.of(httpC...
System.out.println(serviceVersion);
static Stream<Arguments> getTestParameters() { List<Arguments> argumentsList = new ArrayList<>(); getHttpClients() .forEach(httpClient -> { Arrays.stream(CertificateServiceVersion.values()).filter( CertificateClientTestBase::shouldServiceVersionBeTested) .forEach(serviceVersion -> { argumentsList.add(Arguments.of(httpC...
class CertificateClientTestBase extends TestBase { static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; private static final String SDK_NAME = "client_name"; private static final String SDK_VERSION = "client_version"; private static final String AZURE_KEYVAULT_TEST_CERTIFICATE_SERVICE_V...
class CertificateClientTestBase extends TestBase { static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; private static final String SDK_NAME = "client_name"; private static final String SDK_VERSION = "client_version"; private static final String AZURE_KEYVAULT_TEST_CERTIFICATE_SERVICE_V...
nit: completed -> Completed
public void afterTestExecution(ExtensionContext context) { Method testMethod = context.getRequiredTestMethod(); long start = getStore(context).remove(testMethod, long.class); long duration = System.currentTimeMillis() - start; System.out.printf("completed in %d ms.%n", duration); }
System.out.printf("completed in %d ms.%n", duration);
public void afterTestExecution(ExtensionContext context) { TestInformation testInformation = getStore(context) .remove(context.getRequiredTestMethod(), TestInformation.class); long duration = System.currentTimeMillis() - testInformation.startMillis; System.out.printf("%s completed in %d ms.%n", testInformation.logPrefi...
class AzureTestWatcher implements BeforeTestExecutionCallback, AfterTestExecutionCallback { @Override public void beforeTestExecution(ExtensionContext extensionContext) { String displayName = extensionContext.getDisplayName(); getStore(extensionContext).put(extensionContext.getRequiredTestMethod(), System.currentTimeMi...
class AzureTestWatcher implements BeforeTestExecutionCallback, AfterTestExecutionCallback { @Override public void beforeTestExecution(ExtensionContext extensionContext) { String displayName = extensionContext.getDisplayName(); String testName = ""; String fullyQualifiedTestName = ""; if (extensionContext.getTestMethod(...
Do you need a `%n` for these too?
public void beforeTestExecution(ExtensionContext extensionContext) { String displayName = extensionContext.getDisplayName(); getStore(extensionContext).put(extensionContext.getRequiredTestMethod(), System.currentTimeMillis()); String testName = ""; String fullyQualifiedTestName = ""; if (extensionContext.getTestMethod(...
System.out.printf("Starting test %s (%s), ", fullyQualifiedTestName, displayName);
public void beforeTestExecution(ExtensionContext extensionContext) { String displayName = extensionContext.getDisplayName(); String testName = ""; String fullyQualifiedTestName = ""; if (extensionContext.getTestMethod().isPresent()) { Method method = extensionContext.getTestMethod().get(); testName = method.getName(); ...
class AzureTestWatcher implements BeforeTestExecutionCallback, AfterTestExecutionCallback { @Override @Override public void afterTestExecution(ExtensionContext context) { Method testMethod = context.getRequiredTestMethod(); long start = getStore(context).remove(testMethod, long.class); long duration = System.currentTim...
class AzureTestWatcher implements BeforeTestExecutionCallback, AfterTestExecutionCallback { @Override @Override public void afterTestExecution(ExtensionContext context) { TestInformation testInformation = getStore(context) .remove(context.getRequiredTestMethod(), TestInformation.class); long duration = System.currentTi...
The idea was that this and the other print statement would form a single line. Test begins, console view: `Starting test {qualified name} ({display name})` Test completes, console view: `Starting test {qualified name} ({display name}), completed in {millis} ms.{newline}`.
public void afterTestExecution(ExtensionContext context) { Method testMethod = context.getRequiredTestMethod(); long start = getStore(context).remove(testMethod, long.class); long duration = System.currentTimeMillis() - start; System.out.printf("completed in %d ms.%n", duration); }
System.out.printf("completed in %d ms.%n", duration);
public void afterTestExecution(ExtensionContext context) { TestInformation testInformation = getStore(context) .remove(context.getRequiredTestMethod(), TestInformation.class); long duration = System.currentTimeMillis() - testInformation.startMillis; System.out.printf("%s completed in %d ms.%n", testInformation.logPrefi...
class AzureTestWatcher implements BeforeTestExecutionCallback, AfterTestExecutionCallback { @Override public void beforeTestExecution(ExtensionContext extensionContext) { String displayName = extensionContext.getDisplayName(); getStore(extensionContext).put(extensionContext.getRequiredTestMethod(), System.currentTimeMi...
class AzureTestWatcher implements BeforeTestExecutionCallback, AfterTestExecutionCallback { @Override public void beforeTestExecution(ExtensionContext extensionContext) { String displayName = extensionContext.getDisplayName(); String testName = ""; String fullyQualifiedTestName = ""; if (extensionContext.getTestMethod(...
constants code?
public void deserialization() throws IOException { final String errorBody = "{\"error\":{\"code\":\"ResourceGroupNotFound\",\"message\":\"Resource group 'rg-not-exist' could not be found.\"}}"; AzureJacksonAdapter serializerAdapter = new AzureJacksonAdapter(); CloudError cloudError = serializerAdapter.deserialize(error...
final String errorBody = "{\"error\":{\"code\":\"ResourceGroupNotFound\",\"message\":\"Resource group 'rg-not-exist' could not be found.\"}}";
public void deserialization() throws IOException { final String errorBody = "{\"error\":{\"code\":\"ResourceGroupNotFound\",\"message\":\"Resource group 'rg-not-exist' could not be found.\"}}"; AzureJacksonAdapter serializerAdapter = new AzureJacksonAdapter(); CloudError cloudError = serializerAdapter.deserialize(error...
class CloudExceptionTests { @Test }
class CloudExceptionTests { @Test }
A sample response from ARM. Java does not have constants, so `final` should be all?
public void deserialization() throws IOException { final String errorBody = "{\"error\":{\"code\":\"ResourceGroupNotFound\",\"message\":\"Resource group 'rg-not-exist' could not be found.\"}}"; AzureJacksonAdapter serializerAdapter = new AzureJacksonAdapter(); CloudError cloudError = serializerAdapter.deserialize(error...
final String errorBody = "{\"error\":{\"code\":\"ResourceGroupNotFound\",\"message\":\"Resource group 'rg-not-exist' could not be found.\"}}";
public void deserialization() throws IOException { final String errorBody = "{\"error\":{\"code\":\"ResourceGroupNotFound\",\"message\":\"Resource group 'rg-not-exist' could not be found.\"}}"; AzureJacksonAdapter serializerAdapter = new AzureJacksonAdapter(); CloudError cloudError = serializerAdapter.deserialize(error...
class CloudExceptionTests { @Test }
class CloudExceptionTests { @Test }
This code can be replaced by `return str.matches("^[-_.a-zA-Z0-9]+$")`
private boolean isRefreshTokenString(String str) { for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if ((ch < '0' || ch > '9') && (ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z') && ch != '_' && ch != '-' && ch != '.') { return false; } } return true; }
return true;
private boolean isRefreshTokenString(String str) { return REFRESH_TOKEN_PATTERN.matcher(str).matches(); }
class VisualStudioCacheAccessor { private static final String PLATFORM_NOT_SUPPORTED_ERROR = "Platform could not be determined for VS Code" + " credential authentication."; private final ClientLogger logger = new ClientLogger(VisualStudioCacheAccessor.class); /** * Creates an instance of {@link VisualStudioCacheAccesso...
class VisualStudioCacheAccessor { private static final String PLATFORM_NOT_SUPPORTED_ERROR = "Platform could not be determined for VS Code" + " credential authentication."; private final ClientLogger logger = new ClientLogger(VisualStudioCacheAccessor.class); private static final Pattern REFRESH_TOKEN_PATTERN = Pattern...
why `parent()`? maybe only delete this line?
public Mono<T> getByIdAsync(String id) { ResourceId resourceId = ResourceId.fromString(id); if (resourceId.parent() == null) { return null; } return getByParentAsync(resourceId.resourceGroupName(), resourceId.parent().name(), resourceId.name()); }
if (resourceId.parent() == null) {
public Mono<T> getByIdAsync(String id) { ResourceId resourceId = ResourceId.fromString(id); if (resourceId.parent() == null) { return null; } return getByParentAsync(resourceId.resourceGroupName(), resourceId.parent().name(), resourceId.name()); }
class IndependentChildrenImpl< T extends IndependentChild<ManagerT>, ImplT extends T, InnerT, InnerCollectionT, ManagerT extends ManagerBase, ParentT extends Resource & HasResourceGroup> extends CreatableResourcesImpl<T, ImplT, InnerT> implements SupportsGettingById<T>, SupportsGettingByParent<T, ParentT, ManagerT>, Su...
class IndependentChildrenImpl< T extends IndependentChild<ManagerT>, ImplT extends T, InnerT, InnerCollectionT, ManagerT extends ManagerBase, ParentT extends Resource & HasResourceGroup> extends CreatableResourcesImpl<T, ImplT, InnerT> implements SupportsGettingById<T>, SupportsGettingByParent<T, ParentT, ManagerT>, Su...
Since the next line has `resourceId.parent().name()`, so I add `parent()` in it. Is it better not to check this NPE?
public Mono<T> getByIdAsync(String id) { ResourceId resourceId = ResourceId.fromString(id); if (resourceId.parent() == null) { return null; } return getByParentAsync(resourceId.resourceGroupName(), resourceId.parent().name(), resourceId.name()); }
if (resourceId.parent() == null) {
public Mono<T> getByIdAsync(String id) { ResourceId resourceId = ResourceId.fromString(id); if (resourceId.parent() == null) { return null; } return getByParentAsync(resourceId.resourceGroupName(), resourceId.parent().name(), resourceId.name()); }
class IndependentChildrenImpl< T extends IndependentChild<ManagerT>, ImplT extends T, InnerT, InnerCollectionT, ManagerT extends ManagerBase, ParentT extends Resource & HasResourceGroup> extends CreatableResourcesImpl<T, ImplT, InnerT> implements SupportsGettingById<T>, SupportsGettingByParent<T, ParentT, ManagerT>, Su...
class IndependentChildrenImpl< T extends IndependentChild<ManagerT>, ImplT extends T, InnerT, InnerCollectionT, ManagerT extends ManagerBase, ParentT extends Resource & HasResourceGroup> extends CreatableResourcesImpl<T, ImplT, InnerT> implements SupportsGettingById<T>, SupportsGettingByParent<T, ParentT, ManagerT>, Su...
create/use a static final variable for the model id.
static CustomFormModel getExpectedUnlabeledModel() { Map<String, CustomFormModelField> fieldMap = new HashMap<String, CustomFormModelField>() { { put("field-0", new CustomFormModelField("field-0", "Address", null)); put("field-1", new CustomFormModelField("field-1", "Charges", null)); put("field-2", new CustomFormModel...
return new CustomFormModel("95537f1b-aac4-4da8-8292-f1b93ac4c8f8", CustomFormModelStatus.READY,
static CustomFormModel getExpectedUnlabeledModel() { Map<String, CustomFormModelField> fieldMap = new HashMap<String, CustomFormModelField>() { { put("field-0", new CustomFormModelField("field-0", "Address", null)); put("field-1", new CustomFormModelField("field-1", "Charges", null)); put("field-2", new CustomFormModel...
class TestUtils { static final String INVALID_MODEL_ID = "a0a3998a-4c4affe66b7"; static final String INVALID_STATUS_MODEL_ID = "22138c4e-c4b0-4901-a0e1-6c5beb73fc1d"; static final String INVALID_RECEIPT_URL = "https: static final String INVALID_SOURCE_URL_ERROR = "Status code 400, \"{\"error\":{\"code\":\"1003\"," + "\...
class TestUtils { static final String INVALID_MODEL_ID = "a0a3998a-4c4affe66b7"; static final String INVALID_RECEIPT_URL = "https: static final String INVALID_SOURCE_URL_ERROR = "Status code 400, \"{\"error\":{\"code\":\"1003\"," + "\"message\":\"Parameter 'Source' is not a valid Uri.\"}}\""; static final String INVALI...