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
Sure can, has changed across all the places.
DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList<String> paths = new ArrayList<>(); paths.add("/mypk"); partitionKeyDef.setPaths(paths); IndexingPolicy indexingPolicy = new IndexingPolicy(); List<IncludedPath> includedPath...
BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "precision", -1);
DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList<String> paths = new ArrayList<>(); paths.add("/mypk"); partitionKeyDef.setPaths(paths); IndexingPolicy indexingPolicy = new IndexingPolicy(); List<IncludedPath> includedPath...
class ReadMyWritesConsistencyTest { private final static Logger logger = LoggerFactory.getLogger(ReadMyWritesConsistencyTest.class); private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); private final Duration defaultMaxRunningTime = Duration.ofMinutes(45); private final int delayForInitiation...
class ReadMyWritesConsistencyTest { private final static Logger logger = LoggerFactory.getLogger(ReadMyWritesConsistencyTest.class); private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); private final Duration defaultMaxRunningTime = Duration.ofMinutes(45); private final int delayForInitiation...
Two candidates: - `IllegalStateException` : > Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation. - `UnsupportedOperationException` : > Thrown to indicate that the requested ope...
public Azure withDefaultSubscription() { if (profile.subscriptionId() == null) { List<Subscription> subscriptions = new ArrayList<>(); this.subscriptions().list().forEach(subscription -> { subscriptions.add(subscription); }); if (subscriptions.size() == 0) { throw logger.logExceptionAsError( new RuntimeException("Pleas...
new RuntimeException("Please create a subscription before you start resource management. "
public Azure withDefaultSubscription() { if (profile.subscriptionId() == null) { profile.withSubscriptionId(Utils.defaultSubscription(this.subscriptions().list())); } return new Azure(httpPipeline, profile, this); }
class AuthenticatedImpl implements Authenticated { private final ClientLogger logger = new ClientLogger(AuthenticatedImpl.class); private final HttpPipeline httpPipeline; private final AzureProfile profile; private final ResourceManager.Authenticated resourceManagerAuthenticated; private final GraphRbacManager graphRba...
class AuthenticatedImpl implements Authenticated { private final HttpPipeline httpPipeline; private final AzureProfile profile; private final ResourceManager.Authenticated resourceManagerAuthenticated; private final GraphRbacManager graphRbacManager; private SdkContext sdkContext; private AuthenticatedImpl(HttpPipeline...
please have static import so we don't repeat Assertions.
public void setAndGetIncludedPath() { String path = "/*"; IncludedPath includedPath = new IncludedPath(path); List<Index> indexes = new ArrayList<>(); indexes.add(Index.range(DataType.STRING, -1)); indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); List<Index> includedPathIndexes = new Arr...
Assertions.assertThat(includedPathIndexes).hasSize(2);
public void setAndGetIncludedPath() { String path = "/*"; IncludedPath includedPath = new IncludedPath(path); List<Index> indexes = new ArrayList<>(); indexes.add(Index.range(DataType.STRING, -1)); indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); List<Index> includedPathIndexes = new Arr...
class IncludedPathTest { @Test(groups = {"unit"}) }
class IncludedPathTest { @Test(groups = {"unit"}) }
added static import
public void setAndGetIncludedPath() { String path = "/*"; IncludedPath includedPath = new IncludedPath(path); List<Index> indexes = new ArrayList<>(); indexes.add(Index.range(DataType.STRING, -1)); indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); List<Index> includedPathIndexes = new Arr...
Assertions.assertThat(includedPathIndexes).hasSize(2);
public void setAndGetIncludedPath() { String path = "/*"; IncludedPath includedPath = new IncludedPath(path); List<Index> indexes = new ArrayList<>(); indexes.add(Index.range(DataType.STRING, -1)); indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); List<Index> includedPathIndexes = new Arr...
class IncludedPathTest { @Test(groups = {"unit"}) }
class IncludedPathTest { @Test(groups = {"unit"}) }
so, your instructions cover to disable 2FA for the username ?
private void testUserPasswordCanAccessGraph() { assertConfigPresence(AZURE_CLIENT_ID, "testUserPasswordCanAccessGraph - AZURE_CLIENT_ID not configured in the environment."); assertConfigPresence(AZURE_TENANT_ID, "testUserPasswordCanAccessGraph - AZURE_TENANT_ID not configured in the environment."); assertConfigPresence...
.clientId(clientId)
private void testUserPasswordCanAccessGraph() { assertConfigPresence(AZURE_CLIENT_ID, "testUserPasswordCanAccessGraph - AZURE_CLIENT_ID not configured in the environment."); assertConfigPresence(AZURE_TENANT_ID, "testUserPasswordCanAccessGraph - AZURE_TENANT_ID not configured in the environment."); assertConfigPresence...
class MultiTenantTest { private static final String AZURE_MULTI_TENANT_TEST_MODE = "AZURE_MULTI_TENANT_TEST_MODE"; private static final String AZURE_USER_NAME = "AZURE_USER_NAME"; private static final String AZURE_USER_PASSWORD = "AZURE_USER_PASSWORD"; private static final String AZURE_CLIENT_ID = "AZURE_CLIENT_ID"; pr...
class MultiTenantTest { private static final String AZURE_MULTI_TENANT_TEST_MODE = "AZURE_MULTI_TENANT_TEST_MODE"; private static final String AZURE_USER_NAME = "AZURE_USER_NAME"; private static final String AZURE_USER_PASSWORD = "AZURE_USER_PASSWORD"; private static final String AZURE_CLIENT_ID = "AZURE_CLIENT_ID"; pr...
This has to be done in a separate tenant - cannot be done from the Microsoft corporate tenant. By default 2FA is turned off in any new tenant.
private void testUserPasswordCanAccessGraph() { assertConfigPresence(AZURE_CLIENT_ID, "testUserPasswordCanAccessGraph - AZURE_CLIENT_ID not configured in the environment."); assertConfigPresence(AZURE_TENANT_ID, "testUserPasswordCanAccessGraph - AZURE_TENANT_ID not configured in the environment."); assertConfigPresence...
.clientId(clientId)
private void testUserPasswordCanAccessGraph() { assertConfigPresence(AZURE_CLIENT_ID, "testUserPasswordCanAccessGraph - AZURE_CLIENT_ID not configured in the environment."); assertConfigPresence(AZURE_TENANT_ID, "testUserPasswordCanAccessGraph - AZURE_TENANT_ID not configured in the environment."); assertConfigPresence...
class MultiTenantTest { private static final String AZURE_MULTI_TENANT_TEST_MODE = "AZURE_MULTI_TENANT_TEST_MODE"; private static final String AZURE_USER_NAME = "AZURE_USER_NAME"; private static final String AZURE_USER_PASSWORD = "AZURE_USER_PASSWORD"; private static final String AZURE_CLIENT_ID = "AZURE_CLIENT_ID"; pr...
class MultiTenantTest { private static final String AZURE_MULTI_TENANT_TEST_MODE = "AZURE_MULTI_TENANT_TEST_MODE"; private static final String AZURE_USER_NAME = "AZURE_USER_NAME"; private static final String AZURE_USER_PASSWORD = "AZURE_USER_PASSWORD"; private static final String AZURE_CLIENT_ID = "AZURE_CLIENT_ID"; pr...
Is it possible to find a more specific exception type? RuntimeException is generally only viewed as abstract base class. Maybe IllegalStateException, or InvalidArgumentException (if we take that defaultSubscription only works for 1 subscription).
public Azure withDefaultSubscription() { if (profile.subscriptionId() == null) { List<Subscription> subscriptions = new ArrayList<>(); this.subscriptions().list().forEach(subscription -> { subscriptions.add(subscription); }); if (subscriptions.size() == 0) { throw logger.logExceptionAsError( new RuntimeException("Pleas...
new RuntimeException("Please create a subscription before you start resource management. "
public Azure withDefaultSubscription() { if (profile.subscriptionId() == null) { profile.withSubscriptionId(Utils.defaultSubscription(this.subscriptions().list())); } return new Azure(httpPipeline, profile, this); }
class AuthenticatedImpl implements Authenticated { private final ClientLogger logger = new ClientLogger(AuthenticatedImpl.class); private final HttpPipeline httpPipeline; private final AzureProfile profile; private final ResourceManager.Authenticated resourceManagerAuthenticated; private final GraphRbacManager graphRba...
class AuthenticatedImpl implements Authenticated { private final HttpPipeline httpPipeline; private final AzureProfile profile; private final ResourceManager.Authenticated resourceManagerAuthenticated; private final GraphRbacManager graphRbacManager; private SdkContext sdkContext; private AuthenticatedImpl(HttpPipeline...
Is it possible to share some code? Maybe Azure could call some util method in Resources?
public ResourceManager withDefaultSubscription() { if (profile.subscriptionId() == null) { List<Subscription> subscriptions = new ArrayList<>(); this.subscriptions().list().forEach(subscription -> { subscriptions.add(subscription); }); if (subscriptions.size() == 0) { throw logger.logExceptionAsError( new RuntimeExcept...
if (subscriptions.size() == 0) {
public ResourceManager withDefaultSubscription() { if (profile.subscriptionId() == null) { profile.withSubscriptionId(Utils.defaultSubscription(this.subscriptions().list())); } return new ResourceManager(httpPipeline, profile, sdkContext); }
class AuthenticatedImpl implements Authenticated { private final ClientLogger logger = new ClientLogger(AuthenticatedImpl.class); private HttpPipeline httpPipeline; private AzureProfile profile; private SdkContext sdkContext; private SubscriptionClientImpl subscriptionClient; private Subscriptions subscriptions; privat...
class AuthenticatedImpl implements Authenticated { private HttpPipeline httpPipeline; private AzureProfile profile; private SdkContext sdkContext; private SubscriptionClientImpl subscriptionClient; private Subscriptions subscriptions; private Tenants tenants; AuthenticatedImpl(HttpPipeline httpPipeline, AzureProfile pr...
Why create a variable for this?
public Mono<Void> complete(MessageLockToken lockToken) { if (lockToken instanceof ServiceBusReceivedMessage) { return complete(lockToken, ((ServiceBusReceivedMessage) lockToken).getSessionId()); } else { String sessionId = null; return complete(lockToken, sessionId); } }
String sessionId = null;
public Mono<Void> complete(MessageLockToken lockToken) { if (lockToken instanceof ServiceBusReceivedMessage) { return complete(lockToken, ((ServiceBusReceivedMessage) lockToken).getSessionId()); } else { return updateDisposition(lockToken, DispositionStatus.COMPLETED, null, null, null, null, null); } }
class ServiceBusReceiverAsyncClient implements AutoCloseable { private static final DeadLetterOptions DEFAULT_DEAD_LETTER_OPTIONS = new DeadLetterOptions(); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final MessageLockContainer managementNodeLocks; private final ClientLogger logger = new Clien...
class ServiceBusReceiverAsyncClient implements AutoCloseable { private static final DeadLetterOptions DEFAULT_DEAD_LETTER_OPTIONS = new DeadLetterOptions(); private static final String TRANSACTION_LINK_NAME = "coordinator"; private final AtomicBoolean isDisposed = new AtomicBoolean(); private final MessageLockContainer...
`UnsupportedOperationException` is not good here. It is most commonly used in optional operation, which can be left unimplemented at all (like https://docs.oracle.com/javase/7/docs/api/java/util/Collection.html#add(E)). So I would vote `IllegalStateException`.
public Azure withDefaultSubscription() { if (profile.subscriptionId() == null) { List<Subscription> subscriptions = new ArrayList<>(); this.subscriptions().list().forEach(subscription -> { subscriptions.add(subscription); }); if (subscriptions.size() == 0) { throw logger.logExceptionAsError( new RuntimeException("Pleas...
new RuntimeException("Please create a subscription before you start resource management. "
public Azure withDefaultSubscription() { if (profile.subscriptionId() == null) { profile.withSubscriptionId(Utils.defaultSubscription(this.subscriptions().list())); } return new Azure(httpPipeline, profile, this); }
class AuthenticatedImpl implements Authenticated { private final ClientLogger logger = new ClientLogger(AuthenticatedImpl.class); private final HttpPipeline httpPipeline; private final AzureProfile profile; private final ResourceManager.Authenticated resourceManagerAuthenticated; private final GraphRbacManager graphRba...
class AuthenticatedImpl implements Authenticated { private final HttpPipeline httpPipeline; private final AzureProfile profile; private final ResourceManager.Authenticated resourceManagerAuthenticated; private final GraphRbacManager graphRbacManager; private SdkContext sdkContext; private AuthenticatedImpl(HttpPipeline...
Got it. It's not the same as `InvalidOperationException` in csharp. So it's like the `withDefaultSubscription()` cannot be done at this time due to some restrictions if we pick `IllegalStateException`.
public Azure withDefaultSubscription() { if (profile.subscriptionId() == null) { List<Subscription> subscriptions = new ArrayList<>(); this.subscriptions().list().forEach(subscription -> { subscriptions.add(subscription); }); if (subscriptions.size() == 0) { throw logger.logExceptionAsError( new RuntimeException("Pleas...
new RuntimeException("Please create a subscription before you start resource management. "
public Azure withDefaultSubscription() { if (profile.subscriptionId() == null) { profile.withSubscriptionId(Utils.defaultSubscription(this.subscriptions().list())); } return new Azure(httpPipeline, profile, this); }
class AuthenticatedImpl implements Authenticated { private final ClientLogger logger = new ClientLogger(AuthenticatedImpl.class); private final HttpPipeline httpPipeline; private final AzureProfile profile; private final ResourceManager.Authenticated resourceManagerAuthenticated; private final GraphRbacManager graphRba...
class AuthenticatedImpl implements Authenticated { private final HttpPipeline httpPipeline; private final AzureProfile profile; private final ResourceManager.Authenticated resourceManagerAuthenticated; private final GraphRbacManager graphRbacManager; private SdkContext sdkContext; private AuthenticatedImpl(HttpPipeline...
nit: space after if
public RewrittenAggregateProjections(boolean isValueAggregateQuery, Document document) { if (document == null) { throw new IllegalArgumentException("document cannot be null"); } if (isValueAggregateQuery) { this.payload = new Document(document.getPropertyBag()); } else { if (document.get("payload") instanceof ObjectNod...
}
public RewrittenAggregateProjections(boolean isValueAggregateQuery, Document document) { if (document == null) { throw new IllegalArgumentException("document cannot be null"); } if (isValueAggregateQuery) { this.payload = new Document(document.getPropertyBag()); } else { if (!document.has(PAYLOAD_PROPERTY_NAME)) { thro...
class RewrittenAggregateProjections { private Document payload; public Document getPayload() { return payload; } }
class RewrittenAggregateProjections { private Document payload; public Document getPayload() { return payload; } }
Remove log message
private boolean isManagementToken(String lockToken) { logger.verbose("!!!! This token is management token ? ", managementNodeLocks.contains(lockToken)); return managementNodeLocks.contains(lockToken); }
logger.verbose("!!!! This token is management token ? ", managementNodeLocks.contains(lockToken));
private boolean isManagementToken(String lockToken) { return managementNodeLocks.contains(lockToken); }
class ServiceBusReceiverAsyncClient implements AutoCloseable { private static final DeadLetterOptions DEFAULT_DEAD_LETTER_OPTIONS = new DeadLetterOptions(); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final MessageLockContainer managementNodeLocks; private final ClientLogger logger = new Clien...
class ServiceBusReceiverAsyncClient implements AutoCloseable { private static final DeadLetterOptions DEFAULT_DEAD_LETTER_OPTIONS = new DeadLetterOptions(); private static final String TRANSACTION_LINK_NAME = "coordinator"; private final AtomicBoolean isDisposed = new AtomicBoolean(); private final MessageLockContainer...
"payload" spread across few files , can we centralize it with constant ?
public RewrittenAggregateProjections(boolean isValueAggregateQuery, Document document) { if (document == null) { throw new IllegalArgumentException("document cannot be null"); } if (isValueAggregateQuery) { this.payload = new Document(document.getPropertyBag()); } else { if (document.get("payload") instanceof ObjectNod...
if (document.get("payload") instanceof ObjectNode) {
public RewrittenAggregateProjections(boolean isValueAggregateQuery, Document document) { if (document == null) { throw new IllegalArgumentException("document cannot be null"); } if (isValueAggregateQuery) { this.payload = new Document(document.getPropertyBag()); } else { if (!document.has(PAYLOAD_PROPERTY_NAME)) { thro...
class RewrittenAggregateProjections { private Document payload; public Document getPayload() { return payload; } }
class RewrittenAggregateProjections { private Document payload; public Document getPayload() { return payload; } }
nit: extra line after if
public Document getPayload() { Document document = new Document((ObjectNode) this.get(PayloadPropertyName)); if (document == null) { throw new IllegalStateException("Underlying object does not have an 'payload' field."); } return document; }
}
public Document getPayload() { if (!this.has(PAYLOAD_PROPERTY_NAME)) { throw new IllegalStateException("Underlying object does not have an 'payload' field."); } return new Document((ObjectNode) this.get(PAYLOAD_PROPERTY_NAME)); }
class RewrittenGroupByProjection extends JsonSerializable { private static final String GroupByItemsPropertyName = "groupByItems"; private static final String PayloadPropertyName = "payload"; private List<Document> groupByItems; public RewrittenGroupByProjection(ObjectNode objectNode) { super(objectNode); if (objectNod...
class RewrittenGroupByProjection extends JsonSerializable { private static final String GROUP_BY_ITEMS_PROPERTY_NAME = "groupByItems"; private static final String PAYLOAD_PROPERTY_NAME = "payload"; private List<Document> groupByItems; public RewrittenGroupByProjection(ObjectNode objectNode) { super(objectNode); if (obj...
can keys be null ?
public List<Document> drain(int maxItemCount) { Collection<UInt128> keys = this.table.keySet().stream().limit(maxItemCount).collect(Collectors.toList()); List<SingleGroupAggregator> singleGroupAggregators = new ArrayList<>(keys.size()); for (UInt128 key : keys) { singleGroupAggregators.add(this.table.get(key)); this.ta...
Collection<UInt128> keys = this.table.keySet().stream().limit(maxItemCount).collect(Collectors.toList());
public List<Document> drain(int maxItemCount) { Collection<UInt128> keys = this.table.keySet().stream().limit(maxItemCount).collect(Collectors.toList()); List<SingleGroupAggregator> singleGroupAggregators = new ArrayList<>(keys.size()); for (UInt128 key : keys) { singleGroupAggregators.add(this.table.get(key)); this.ta...
class GroupingTable { private static final List<AggregateOperator> EmptyAggregateOperators = new ArrayList<>(); private final Map<UInt128, SingleGroupAggregator> table; private final Map<String, AggregateOperator> groupByAliasToAggregateType; private final List<String> orderedAliases; private final boolean hasSelectVal...
class GroupingTable { private static final List<AggregateOperator> EMPTY_AGGREGATE_OPERATORS = new ArrayList<>(); private final Map<UInt128, SingleGroupAggregator> table; private final Map<String, AggregateOperator> groupByAliasToAggregateType; private final List<String> orderedAliases; private final boolean hasSelectV...
What is the use of map here ?
public Document getResult() { Document aggregateDocument = new Document(); for (String alias : this.orderedAliases) { AggregateValue aggregateValue = this.aliasToValue.get(alias); if (aggregateValue.getResult() != null) { Map<String, Object> map = new HashMap<>(); map.put(alias, aggregateValue.getResult()); aggregateD...
map.put(alias, aggregateValue.getResult());
public Document getResult() { Document document; Object result = aggregateValue.getResult(); if (result instanceof Document) { document = (Document) aggregateValue.getResult(); } else { document = new Document(); if (result instanceof Undefined) { result = null; } document.set(Constants.Properties.VALUE, result); } ret...
class SelectValueAggregateValues extends SingleGroupAggregator { private final AggregateValue aggregateValue; public SelectValueAggregateValues(AggregateValue aggregateValue) { this.aggregateValue = aggregateValue; } public static SingleGroupAggregator create(AggregateOperator aggregateOperator, String continuationToke...
class SelectValueAggregateValues extends SingleGroupAggregator { private final AggregateValue aggregateValue; public SelectValueAggregateValues(AggregateValue aggregateValue) { this.aggregateValue = aggregateValue; } public static SingleGroupAggregator create(AggregateOperator aggregateOperator, String continuationToke...
There are overloads for complete() which makes this call ambiguous for compiler. This this was needed, But I am replacing this with direct call to `updateDisposition`
public Mono<Void> complete(MessageLockToken lockToken) { if (lockToken instanceof ServiceBusReceivedMessage) { return complete(lockToken, ((ServiceBusReceivedMessage) lockToken).getSessionId()); } else { String sessionId = null; return complete(lockToken, sessionId); } }
String sessionId = null;
public Mono<Void> complete(MessageLockToken lockToken) { if (lockToken instanceof ServiceBusReceivedMessage) { return complete(lockToken, ((ServiceBusReceivedMessage) lockToken).getSessionId()); } else { return updateDisposition(lockToken, DispositionStatus.COMPLETED, null, null, null, null, null); } }
class ServiceBusReceiverAsyncClient implements AutoCloseable { private static final DeadLetterOptions DEFAULT_DEAD_LETTER_OPTIONS = new DeadLetterOptions(); private final AtomicBoolean isDisposed = new AtomicBoolean(); private final MessageLockContainer managementNodeLocks; private final ClientLogger logger = new Clien...
class ServiceBusReceiverAsyncClient implements AutoCloseable { private static final DeadLetterOptions DEFAULT_DEAD_LETTER_OPTIONS = new DeadLetterOptions(); private static final String TRANSACTION_LINK_NAME = "coordinator"; private final AtomicBoolean isDisposed = new AtomicBoolean(); private final MessageLockContainer...
why continuation token is null here?
public Resource getDocumentContinuationToken() { return null; }
return null;
public Resource getDocumentContinuationToken() { return null; }
class SelectValueAggregateValues extends SingleGroupAggregator { private final AggregateValue aggregateValue; public SelectValueAggregateValues(AggregateValue aggregateValue) { this.aggregateValue = aggregateValue; } public static SingleGroupAggregator create(AggregateOperator aggregateOperator, String continuationToke...
class SelectValueAggregateValues extends SingleGroupAggregator { private final AggregateValue aggregateValue; public SelectValueAggregateValues(AggregateValue aggregateValue) { this.aggregateValue = aggregateValue; } public static SingleGroupAggregator create(AggregateOperator aggregateOperator, String continuationToke...
Since there is no ordering in the `keySet()` API - are we just limiting with `maxItemCount` randomly on the keys in `this.table` map ?
public List<Document> drain(int maxItemCount) { Collection<UInt128> keys = this.table.keySet().stream().limit(maxItemCount).collect(Collectors.toList()); List<SingleGroupAggregator> singleGroupAggregators = new ArrayList<>(keys.size()); for (UInt128 key : keys) { singleGroupAggregators.add(this.table.get(key)); this.ta...
Collection<UInt128> keys = this.table.keySet().stream().limit(maxItemCount).collect(Collectors.toList());
public List<Document> drain(int maxItemCount) { Collection<UInt128> keys = this.table.keySet().stream().limit(maxItemCount).collect(Collectors.toList()); List<SingleGroupAggregator> singleGroupAggregators = new ArrayList<>(keys.size()); for (UInt128 key : keys) { singleGroupAggregators.add(this.table.get(key)); this.ta...
class GroupingTable { private static final List<AggregateOperator> EmptyAggregateOperators = new ArrayList<>(); private final Map<UInt128, SingleGroupAggregator> table; private final Map<String, AggregateOperator> groupByAliasToAggregateType; private final List<String> orderedAliases; private final boolean hasSelectVal...
class GroupingTable { private static final List<AggregateOperator> EMPTY_AGGREGATE_OPERATORS = new ArrayList<>(); private final Map<UInt128, SingleGroupAggregator> table; private final Map<String, AggregateOperator> groupByAliasToAggregateType; private final List<String> orderedAliases; private final boolean hasSelectV...
if "payload" does not exist, then this should throw an exception.
public RewrittenAggregateProjections(boolean isValueAggregateQuery, Document document) { if (document == null) { throw new IllegalArgumentException("document cannot be null"); } if (isValueAggregateQuery) { this.payload = new Document(document.getPropertyBag()); } else { if (document.get("payload") instanceof ObjectNod...
if (document.get("payload") instanceof ObjectNode) {
public RewrittenAggregateProjections(boolean isValueAggregateQuery, Document document) { if (document == null) { throw new IllegalArgumentException("document cannot be null"); } if (isValueAggregateQuery) { this.payload = new Document(document.getPropertyBag()); } else { if (!document.has(PAYLOAD_PROPERTY_NAME)) { thro...
class RewrittenAggregateProjections { private Document payload; public Document getPayload() { return payload; } }
class RewrittenAggregateProjections { private Document payload; public Document getPayload() { return payload; } }
You can use Mono.fromRunnable
private Mono<Void> validateEndpoint() { return Mono.defer(() -> { if (hasConnected.get()) { return Mono.empty(); } else { return RetryUtil.withRetry( handler.getEndpointStates().takeUntil(state -> state == EndpointState.ACTIVE), timeout, retry) .then(); } }); }
return Mono.defer(() -> {
private Mono<Void> validateEndpoint() { return Mono.defer(() -> { if (hasConnected.get()) { return Mono.empty(); } else { return RetryUtil.withRetry( handler.getEndpointStates().takeUntil(state -> state == EndpointState.ACTIVE), timeout, retry) .then(); } }); }
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
This isn't going to work, since `1.0` and `1.00` need to hash to the same value. Also strings and their different escaped variants.
public static UInt128 getHash(Object resource) throws IOException { if (resource instanceof List) { return getHashFromList((List<Object>) resource); } if (resource instanceof JsonSerializable) { return getHashFromJsonSerializable((JsonSerializable) resource); } final byte[] bytes = Utils.serializeObjectToByteArray(reso...
final byte[] bytes = Utils.serializeObjectToByteArray(resource);
public static UInt128 getHash(Object resource) throws IOException { if (resource instanceof List) { return getHashFromList((List<Object>) resource); } if (resource instanceof JsonSerializable) { return getHashFromJsonSerializable((JsonSerializable) resource); } final byte[] bytes = Utils.serializeObjectToByteArray(reso...
class DistinctHash { private static final UInt128 ArrayHashSeed = new UInt128(0xfa573b014c4dc18eL, 0xa014512c858eb115L); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true) .configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); @...
class DistinctHash { private static final UInt128 ARRAY_HASH_SEED = new UInt128(0xfa573b014c4dc18eL, 0xa014512c858eb115L); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true) .configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);...
The ordering doesn't matter in this scenario. The user is just getting back some subset of the keys. It's never defined what order that would be.
public List<Document> drain(int maxItemCount) { Collection<UInt128> keys = this.table.keySet().stream().limit(maxItemCount).collect(Collectors.toList()); List<SingleGroupAggregator> singleGroupAggregators = new ArrayList<>(keys.size()); for (UInt128 key : keys) { singleGroupAggregators.add(this.table.get(key)); this.ta...
Collection<UInt128> keys = this.table.keySet().stream().limit(maxItemCount).collect(Collectors.toList());
public List<Document> drain(int maxItemCount) { Collection<UInt128> keys = this.table.keySet().stream().limit(maxItemCount).collect(Collectors.toList()); List<SingleGroupAggregator> singleGroupAggregators = new ArrayList<>(keys.size()); for (UInt128 key : keys) { singleGroupAggregators.add(this.table.get(key)); this.ta...
class GroupingTable { private static final List<AggregateOperator> EmptyAggregateOperators = new ArrayList<>(); private final Map<UInt128, SingleGroupAggregator> table; private final Map<String, AggregateOperator> groupByAliasToAggregateType; private final List<String> orderedAliases; private final boolean hasSelectVal...
class GroupingTable { private static final List<AggregateOperator> EMPTY_AGGREGATE_OPERATORS = new ArrayList<>(); private final Map<UInt128, SingleGroupAggregator> table; private final Map<String, AggregateOperator> groupByAliasToAggregateType; private final List<String> orderedAliases; private final boolean hasSelectV...
Yup, need to add more tests for groupby. Plan is to get this in and run the Queryoracle. In the mean time will also try to add more tests
public void queryDocuments() { boolean qmEnabled = true; String query = "SELECT sum(c.age) as sum_age, c.city FROM c group by c.city"; QueryRequestOptions options = new QueryRequestOptions(); ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 35); options.setQueryMetricsEnabled(qmEnabled); options.setMaxDe...
String query = "SELECT sum(c.age) as sum_age, c.city FROM c group by c.city";
public void queryDocuments() { boolean qmEnabled = true; String query = "SELECT sum(c.age) as sum_age, c.city FROM c group by c.city"; CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 35); options.setQueryMetricsEnabled(qmEnabled); opti...
class GroupByQueryTests extends TestSuiteBase { List<Person> personList; private CosmosAsyncContainer createdCollection; private ArrayList<CosmosItemProperties> docs = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuildersWithDirect") public GroupByQueryTests(CosmosClientBuilder cl...
class GroupByQueryTests extends TestSuiteBase { List<Person> personList; private CosmosAsyncContainer createdCollection; private ArrayList<InternalObjectNode> docs = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuildersWithDirect") public GroupByQueryTests(CosmosClientBuilder clie...
There are a lot of other cases that need to be covered.
public void queryDocuments() { boolean qmEnabled = true; String query = "SELECT sum(c.age) as sum_age, c.city FROM c group by c.city"; QueryRequestOptions options = new QueryRequestOptions(); ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 35); options.setQueryMetricsEnabled(qmEnabled); options.setMaxDe...
String query = "SELECT sum(c.age) as sum_age, c.city FROM c group by c.city";
public void queryDocuments() { boolean qmEnabled = true; String query = "SELECT sum(c.age) as sum_age, c.city FROM c group by c.city"; CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 35); options.setQueryMetricsEnabled(qmEnabled); opti...
class GroupByQueryTests extends TestSuiteBase { List<Person> personList; private CosmosAsyncContainer createdCollection; private ArrayList<CosmosItemProperties> docs = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuildersWithDirect") public GroupByQueryTests(CosmosClientBuilder cl...
class GroupByQueryTests extends TestSuiteBase { List<Person> personList; private CosmosAsyncContainer createdCollection; private ArrayList<InternalObjectNode> docs = new ArrayList<>(); private CosmosAsyncClient client; @Factory(dataProvider = "clientBuildersWithDirect") public GroupByQueryTests(CosmosClientBuilder clie...
done
public Document getPayload() { Document document = new Document((ObjectNode) this.get(PayloadPropertyName)); if (document == null) { throw new IllegalStateException("Underlying object does not have an 'payload' field."); } return document; }
}
public Document getPayload() { if (!this.has(PAYLOAD_PROPERTY_NAME)) { throw new IllegalStateException("Underlying object does not have an 'payload' field."); } return new Document((ObjectNode) this.get(PAYLOAD_PROPERTY_NAME)); }
class RewrittenGroupByProjection extends JsonSerializable { private static final String GroupByItemsPropertyName = "groupByItems"; private static final String PayloadPropertyName = "payload"; private List<Document> groupByItems; public RewrittenGroupByProjection(ObjectNode objectNode) { super(objectNode); if (objectNod...
class RewrittenGroupByProjection extends JsonSerializable { private static final String GROUP_BY_ITEMS_PROPERTY_NAME = "groupByItems"; private static final String PAYLOAD_PROPERTY_NAME = "payload"; private List<Document> groupByItems; public RewrittenGroupByProjection(ObjectNode objectNode) { super(objectNode); if (obj...
collect will always initialize the list, so can never be null even when stream is empty
public List<Document> drain(int maxItemCount) { Collection<UInt128> keys = this.table.keySet().stream().limit(maxItemCount).collect(Collectors.toList()); List<SingleGroupAggregator> singleGroupAggregators = new ArrayList<>(keys.size()); for (UInt128 key : keys) { singleGroupAggregators.add(this.table.get(key)); this.ta...
Collection<UInt128> keys = this.table.keySet().stream().limit(maxItemCount).collect(Collectors.toList());
public List<Document> drain(int maxItemCount) { Collection<UInt128> keys = this.table.keySet().stream().limit(maxItemCount).collect(Collectors.toList()); List<SingleGroupAggregator> singleGroupAggregators = new ArrayList<>(keys.size()); for (UInt128 key : keys) { singleGroupAggregators.add(this.table.get(key)); this.ta...
class GroupingTable { private static final List<AggregateOperator> EmptyAggregateOperators = new ArrayList<>(); private final Map<UInt128, SingleGroupAggregator> table; private final Map<String, AggregateOperator> groupByAliasToAggregateType; private final List<String> orderedAliases; private final boolean hasSelectVal...
class GroupingTable { private static final List<AggregateOperator> EMPTY_AGGREGATE_OPERATORS = new ArrayList<>(); private final Map<UInt128, SingleGroupAggregator> table; private final Map<String, AggregateOperator> groupByAliasToAggregateType; private final List<String> orderedAliases; private final boolean hasSelectV...
Stale code, removed.
public Document getResult() { Document aggregateDocument = new Document(); for (String alias : this.orderedAliases) { AggregateValue aggregateValue = this.aliasToValue.get(alias); if (aggregateValue.getResult() != null) { Map<String, Object> map = new HashMap<>(); map.put(alias, aggregateValue.getResult()); aggregateD...
map.put(alias, aggregateValue.getResult());
public Document getResult() { Document document; Object result = aggregateValue.getResult(); if (result instanceof Document) { document = (Document) aggregateValue.getResult(); } else { document = new Document(); if (result instanceof Undefined) { result = null; } document.set(Constants.Properties.VALUE, result); } ret...
class SelectValueAggregateValues extends SingleGroupAggregator { private final AggregateValue aggregateValue; public SelectValueAggregateValues(AggregateValue aggregateValue) { this.aggregateValue = aggregateValue; } public static SingleGroupAggregator create(AggregateOperator aggregateOperator, String continuationToke...
class SelectValueAggregateValues extends SingleGroupAggregator { private final AggregateValue aggregateValue; public SelectValueAggregateValues(AggregateValue aggregateValue) { this.aggregateValue = aggregateValue; } public static SingleGroupAggregator create(AggregateOperator aggregateOperator, String continuationToke...
Continuation token is not yet supported for this, this method not referenced yet. Will change this when implementing cont.token.
public Resource getDocumentContinuationToken() { return null; }
return null;
public Resource getDocumentContinuationToken() { return null; }
class SelectValueAggregateValues extends SingleGroupAggregator { private final AggregateValue aggregateValue; public SelectValueAggregateValues(AggregateValue aggregateValue) { this.aggregateValue = aggregateValue; } public static SingleGroupAggregator create(AggregateOperator aggregateOperator, String continuationToke...
class SelectValueAggregateValues extends SingleGroupAggregator { private final AggregateValue aggregateValue; public SelectValueAggregateValues(AggregateValue aggregateValue) { this.aggregateValue = aggregateValue; } public static SingleGroupAggregator create(AggregateOperator aggregateOperator, String continuationToke...
Added check
public RewrittenAggregateProjections(boolean isValueAggregateQuery, Document document) { if (document == null) { throw new IllegalArgumentException("document cannot be null"); } if (isValueAggregateQuery) { this.payload = new Document(document.getPropertyBag()); } else { if (document.get("payload") instanceof ObjectNod...
if (document.get("payload") instanceof ObjectNode) {
public RewrittenAggregateProjections(boolean isValueAggregateQuery, Document document) { if (document == null) { throw new IllegalArgumentException("document cannot be null"); } if (isValueAggregateQuery) { this.payload = new Document(document.getPropertyBag()); } else { if (!document.has(PAYLOAD_PROPERTY_NAME)) { thro...
class RewrittenAggregateProjections { private Document payload; public Document getPayload() { return payload; } }
class RewrittenAggregateProjections { private Document payload; public Document getPayload() { return payload; } }
Updated formPage, formTable to loop over an indexed loop but for others the index isn't used in the sample so left as is.
public static void main(String[] args) { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildAsyncClient(); String modelId = "{model_Id}"; String filePath = "{file_source_url}"; PollerFlux<OperationResult, List<RecognizedForm>> recogn...
public static void main(String[] args) { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildAsyncClient(); String modelId = "{model_Id}"; String filePath = "{file_source_url}"; PollerFlux<OperationResult, List<RecognizedForm>> recogn...
class GetBoundingBoxesAsync { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. */ }
class GetBoundingBoxesAsync { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. */ }
Have tests for checking 1.0 vs 1 and they pass
public static UInt128 getHash(Object resource) throws IOException { if (resource instanceof List) { return getHashFromList((List<Object>) resource); } if (resource instanceof JsonSerializable) { return getHashFromJsonSerializable((JsonSerializable) resource); } final byte[] bytes = Utils.serializeObjectToByteArray(reso...
final byte[] bytes = Utils.serializeObjectToByteArray(resource);
public static UInt128 getHash(Object resource) throws IOException { if (resource instanceof List) { return getHashFromList((List<Object>) resource); } if (resource instanceof JsonSerializable) { return getHashFromJsonSerializable((JsonSerializable) resource); } final byte[] bytes = Utils.serializeObjectToByteArray(reso...
class DistinctHash { private static final UInt128 ArrayHashSeed = new UInt128(0xfa573b014c4dc18eL, 0xa014512c858eb115L); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true) .configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); @...
class DistinctHash { private static final UInt128 ARRAY_HASH_SEED = new UInt128(0xfa573b014c4dc18eL, 0xa014512c858eb115L); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true) .configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);...
done
public RewrittenAggregateProjections(boolean isValueAggregateQuery, Document document) { if (document == null) { throw new IllegalArgumentException("document cannot be null"); } if (isValueAggregateQuery) { this.payload = new Document(document.getPropertyBag()); } else { if (document.get("payload") instanceof ObjectNod...
}
public RewrittenAggregateProjections(boolean isValueAggregateQuery, Document document) { if (document == null) { throw new IllegalArgumentException("document cannot be null"); } if (isValueAggregateQuery) { this.payload = new Document(document.getPropertyBag()); } else { if (!document.has(PAYLOAD_PROPERTY_NAME)) { thro...
class RewrittenAggregateProjections { private Document payload; public Document getPayload() { return payload; } }
class RewrittenAggregateProjections { private Document payload; public Document getPayload() { return payload; } }
Don't think you made this change in the sync sample
public static void main(String[] args) { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildAsyncClient(); String modelId = "{model_Id}"; String filePath = "{file_source_url}"; PollerFlux<OperationResult, List<RecognizedForm>> recogn...
public static void main(String[] args) { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildAsyncClient(); String modelId = "{model_Id}"; String filePath = "{file_source_url}"; PollerFlux<OperationResult, List<RecognizedForm>> recogn...
class GetBoundingBoxesAsync { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. */ }
class GetBoundingBoxesAsync { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. */ }
You need to reformat this document, there are two spaces after `instanceof`
private void processDeliveredMessage(Delivery delivery) { final DeliveryState outcome = delivery.getRemoteState(); final String deliveryTag = new String(delivery.getTag(), UTF_8); logger.verbose("entityPath[{}], linkName[{}], deliveryTag[{}]: process delivered message", entityPath, getLinkName(), deliveryTag); final Re...
.getOutcome() instanceof Accepted)) {
private void processDeliveredMessage(Delivery delivery) { final DeliveryState outcome = delivery.getRemoteState(); final String deliveryTag = new String(delivery.getTag(), UTF_8); logger.verbose("entityPath[{}], linkName[{}], deliveryTag[{}]: process delivered message", entityPath, getLinkName(), deliveryTag); final Re...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
same with spaces.
private void processDeliveredMessage(Delivery delivery) { final DeliveryState outcome = delivery.getRemoteState(); final String deliveryTag = new String(delivery.getTag(), UTF_8); logger.verbose("entityPath[{}], linkName[{}], deliveryTag[{}]: process delivered message", entityPath, getLinkName(), deliveryTag); final Re...
.getOutcome() instanceof Rejected)) {
private void processDeliveredMessage(Delivery delivery) { final DeliveryState outcome = delivery.getRemoteState(); final String deliveryTag = new String(delivery.getTag(), UTF_8); logger.verbose("entityPath[{}], linkName[{}], deliveryTag[{}]: process delivered message", entityPath, getLinkName(), deliveryTag); final Re...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
I'm wary of casting this to ReactorSender. Does the TransactionCoordinator also have a ReactorSender? Your current implementation adds more responsibility to ReactorSender. It not only handles sending messages, but also transactions. It would be a better separation of concerns to have a TransactionCoordinator class tha...
public Mono<AmqpTransaction> createTransaction() { return createTransactionCoordinator() .cast(ReactorSender.class) .flatMap(coordinator -> { return coordinator.createTransaction(); }); }
.cast(ReactorSender.class)
public Mono<AmqpTransaction> createTransaction() { return createTransactionCoordinator() .flatMap(coordinator -> coordinator.createTransaction()); }
class ReactorSession implements AmqpSession { private static final String TRANSACTION_LINK_NAME = "coordinator"; private final ConcurrentMap<String, LinkSubscription<AmqpSendLink>> openSendLinks = new ConcurrentHashMap<>(); private final ConcurrentMap<String, LinkSubscription<AmqpReceiveLink>> openReceiveLinks = new Co...
class ReactorSession implements AmqpSession { private static final String TRANSACTION_LINK_NAME = "coordinator"; private final ConcurrentMap<String, LinkSubscription<AmqpSendLink>> openSendLinks = new ConcurrentHashMap<>(); private final ConcurrentMap<String, LinkSubscription<AmqpReceiveLink>> openReceiveLinks = new Co...
I already had a separate class `ReactorCoordinator` , in order to separate concern butI had to replicate most of the code from `ReactorSender` into this. You pointed that out in your comment https://github.com/Azure/azure-sdk-for-java/pull/11305#discussion_r431517190 and you asked to consolidate the code . Actually ...
public Mono<AmqpTransaction> createTransaction() { return createTransactionCoordinator() .cast(ReactorSender.class) .flatMap(coordinator -> { return coordinator.createTransaction(); }); }
.cast(ReactorSender.class)
public Mono<AmqpTransaction> createTransaction() { return createTransactionCoordinator() .flatMap(coordinator -> coordinator.createTransaction()); }
class ReactorSession implements AmqpSession { private static final String TRANSACTION_LINK_NAME = "coordinator"; private final ConcurrentMap<String, LinkSubscription<AmqpSendLink>> openSendLinks = new ConcurrentHashMap<>(); private final ConcurrentMap<String, LinkSubscription<AmqpReceiveLink>> openReceiveLinks = new Co...
class ReactorSession implements AmqpSession { private static final String TRANSACTION_LINK_NAME = "coordinator"; private final ConcurrentMap<String, LinkSubscription<AmqpSendLink>> openSendLinks = new ConcurrentHashMap<>(); private final ConcurrentMap<String, LinkSubscription<AmqpReceiveLink>> openReceiveLinks = new Co...
This can be even more abstracted by accepting a deliveryState parameter rather than an AmqpTransaction. That way, all usages of AmqpTransaction are removed from this class and abstracted into the coordinator. The RetriableWorkItem no longer has a reference on a transaction, and a delivery state instead. ```java Mono<D...
private void processSendWork() { if (!hasConnected.get()) { logger.warning("Not connected. Not processing send work."); return; } while (hasConnected.get() && sender.getCredit() > 0) { final WeightedDeliveryTag weightedDelivery; final RetriableWorkItem workItem; final String deliveryTag; synchronized (pendingSendLock) ...
AmqpTransaction transactionId = workItem.getTransactionId();
private void processSendWork() { if (!hasConnected.get()) { logger.warning("Not connected. Not processing send work."); return; } while (hasConnected.get() && sender.getCredit() > 0) { final WeightedDeliveryTag weightedDelivery; final RetriableWorkItem workItem; final String deliveryTag; synchronized (pendingSendLock) ...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
We use AmqpSendLink directly in `ServiceBusSenderAsyncClient` to send message. This change will introduce a amqp deep concept of `DeliveryState ` into `ServiceBusSenderAsyncClient` which is unnecessary, I think . `AmqpTransaction` is working as abstraction here.
private void processSendWork() { if (!hasConnected.get()) { logger.warning("Not connected. Not processing send work."); return; } while (hasConnected.get() && sender.getCredit() > 0) { final WeightedDeliveryTag weightedDelivery; final RetriableWorkItem workItem; final String deliveryTag; synchronized (pendingSendLock) ...
AmqpTransaction transactionId = workItem.getTransactionId();
private void processSendWork() { if (!hasConnected.get()) { logger.warning("Not connected. Not processing send work."); return; } while (hasConnected.get() && sender.getCredit() > 0) { final WeightedDeliveryTag weightedDelivery; final RetriableWorkItem workItem; final String deliveryTag; synchronized (pendingSendLock) ...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
Still unresolved.
private void processDeliveredMessage(Delivery delivery) { final DeliveryState outcome = delivery.getRemoteState(); final String deliveryTag = new String(delivery.getTag(), UTF_8); logger.verbose("entityPath[{}], linkName[{}], deliveryTag[{}]: process delivered message", entityPath, getLinkName(), deliveryTag); final Re...
.getOutcome() instanceof Rejected)) {
private void processDeliveredMessage(Delivery delivery) { final DeliveryState outcome = delivery.getRemoteState(); final String deliveryTag = new String(delivery.getTag(), UTF_8); logger.verbose("entityPath[{}], linkName[{}], deliveryTag[{}]: process delivered message", entityPath, getLinkName(), deliveryTag); final Re...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
The sink should return an error (`sink.error(...)`) what I meant was to move all your other logic from ReactorSender (line452...) for processing DeliveryState into here. ### ReactorSender ```java //@returns the DeliveryState for the associated send operation. Mono<DeliveryState> send(byte[] amqpMessage, int encodedMes...
Mono<Void> completeTransaction(AmqpTransaction transaction, boolean isCommit) { return Mono.fromCallable(() -> { final Message message = Proton.message(); Discharge discharge = new Discharge(); discharge.setFail(!isCommit); discharge.setTxnId(new Binary(transaction.getTransactionId().array())); message.setBody(new Amqp...
logger.error("Transaction [{}] could not be completed, Service Bus status [{}].",
Mono<Void> completeTransaction(AmqpTransaction transaction, boolean isCommit) { final Message message = Proton.message(); Discharge discharge = new Discharge(); discharge.setFail(!isCommit); discharge.setTxnId(new Binary(transaction.getTransactionId().array())); message.setBody(new AmqpValue(discharge)); final int payl...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
// Arrange
public void testSendWithTransaction() { Message message = Proton.message(); message.setMessageId("id"); message.setBody(new AmqpValue("hello")); AmqpTransaction transaction = new AmqpTransaction(ByteBuffer.wrap("1".getBytes())); ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvide...
Message message = Proton.message();
public void testSendWithTransaction() { Message message = Proton.message(); message.setMessageId("id"); message.setBody(new AmqpValue("hello")); ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager, messageSerializer, Duration.ofSeconds(1), new ExponentialAmqpRetryP...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
new line then: // Act
public void testSendWithTransaction() { Message message = Proton.message(); message.setMessageId("id"); message.setBody(new AmqpValue("hello")); AmqpTransaction transaction = new AmqpTransaction(ByteBuffer.wrap("1".getBytes())); ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvide...
StepVerifier.create(spyReactorSender.send(message, transaction))
public void testSendWithTransaction() { Message message = Proton.message(); message.setMessageId("id"); message.setBody(new AmqpValue("hello")); ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager, messageSerializer, Duration.ofSeconds(1), new ExponentialAmqpRetryP...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
// Assert
public void testSendWithTransaction() { Message message = Proton.message(); message.setMessageId("id"); message.setBody(new AmqpValue("hello")); AmqpTransaction transaction = new AmqpTransaction(ByteBuffer.wrap("1".getBytes())); ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvide...
verify(sender, times(1)).getRemoteMaxMessageSize();
public void testSendWithTransaction() { Message message = Proton.message(); message.setMessageId("id"); message.setBody(new AmqpValue("hello")); ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager, messageSerializer, Duration.ofSeconds(1), new ExponentialAmqpRetryP...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
I'm confused what you are actually testing here... Just that it eventually calls the send() overload?
public void testSendWithTransaction() { Message message = Proton.message(); message.setMessageId("id"); message.setBody(new AmqpValue("hello")); AmqpTransaction transaction = new AmqpTransaction(ByteBuffer.wrap("1".getBytes())); ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvide...
ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager,
public void testSendWithTransaction() { Message message = Proton.message(); message.setMessageId("id"); message.setBody(new AmqpValue("hello")); ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager, messageSerializer, Duration.ofSeconds(1), new ExponentialAmqpRetryP...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
There are no unit tests here that actually test the complex logic in your ReactorSender operation.. (which will eventually moved to TransactionCoordinator)
public void testLinkSize() throws IOException { ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager, messageSerializer, Duration.ofSeconds(1), new ExponentialAmqpRetryPolicy(new AmqpRetryOptions())); StepVerifier.create(reactorSender.getLinkSize()) .expectNext(1000...
verify(sender, times(1)).getRemoteMaxMessageSize();
public void testLinkSize() { ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager, messageSerializer, Duration.ofSeconds(1), new ExponentialAmqpRetryPolicy(new AmqpRetryOptions())); StepVerifier.create(reactorSender.getLinkSize()) .expectNext(1000) .verifyComplete()...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
txn -> transaction
public void testCreateTransaction() { final String transactionId = "1"; Declared transactionState = new Declared(); transactionState.setTxnId(Binary.create(ByteBuffer.wrap(transactionId.getBytes()))); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono....
.map(txn -> {
public void testCreateTransaction() { final byte[] transactionId = "1".getBytes(); Declared transactionState = new Declared(); transactionState.setTxnId(Binary.create(ByteBuffer.wrap(transactionId))); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono....
class TransactionCoordinatorTest { @Mock private MessageSerializer messageSerializer; @Mock AmqpSendLink sendLink; @BeforeEach public void setup() throws IOException { MockitoAnnotations.initMocks(this); } @Test public void testCompleteTransaction() { final String transactionId = "1"; Declared transactionState = new De...
class TransactionCoordinatorTest { @Mock private MessageSerializer messageSerializer; @Mock private AmqpSendLink sendLink; @BeforeEach public void setup() { MockitoAnnotations.initMocks(this); } @ParameterizedTest @ValueSource(booleans = {true, false}) public void testCompleteTransactionRejected(boolean isCommit) { fin...
You should be using assertNext rather than a map and setting it through an atomic reference.
public void testCreateTransaction() { final String transactionId = "1"; Declared transactionState = new Declared(); transactionState.setTxnId(Binary.create(ByteBuffer.wrap(transactionId.getBytes()))); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono....
.map(txn -> {
public void testCreateTransaction() { final byte[] transactionId = "1".getBytes(); Declared transactionState = new Declared(); transactionState.setTxnId(Binary.create(ByteBuffer.wrap(transactionId))); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono....
class TransactionCoordinatorTest { @Mock private MessageSerializer messageSerializer; @Mock AmqpSendLink sendLink; @BeforeEach public void setup() throws IOException { MockitoAnnotations.initMocks(this); } @Test public void testCompleteTransaction() { final String transactionId = "1"; Declared transactionState = new De...
class TransactionCoordinatorTest { @Mock private MessageSerializer messageSerializer; @Mock private AmqpSendLink sendLink; @BeforeEach public void setup() { MockitoAnnotations.initMocks(this); } @ParameterizedTest @ValueSource(booleans = {true, false}) public void testCompleteTransactionRejected(boolean isCommit) { fin...
This should be an assertEquals rather than a true.
public void testCreateTransaction() { final String transactionId = "1"; Declared transactionState = new Declared(); transactionState.setTxnId(Binary.create(ByteBuffer.wrap(transactionId.getBytes()))); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono....
Assertions.assertTrue(new String(createdTransaction.get().getTransactionId().array()).equals(transactionId),
public void testCreateTransaction() { final byte[] transactionId = "1".getBytes(); Declared transactionState = new Declared(); transactionState.setTxnId(Binary.create(ByteBuffer.wrap(transactionId))); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono....
class TransactionCoordinatorTest { @Mock private MessageSerializer messageSerializer; @Mock AmqpSendLink sendLink; @BeforeEach public void setup() throws IOException { MockitoAnnotations.initMocks(this); } @Test public void testCompleteTransaction() { final String transactionId = "1"; Declared transactionState = new De...
class TransactionCoordinatorTest { @Mock private MessageSerializer messageSerializer; @Mock private AmqpSendLink sendLink; @BeforeEach public void setup() { MockitoAnnotations.initMocks(this); } @ParameterizedTest @ValueSource(booleans = {true, false}) public void testCompleteTransactionRejected(boolean isCommit) { fin...
Why is this mapped in a callable?? It can be synchronous and then pass the values onwards. I don't see why we're creating a Tuple.
Mono<Void> completeTransaction(AmqpTransaction transaction, boolean isCommit) { return Mono.fromCallable(() -> { final Message message = Proton.message(); Discharge discharge = new Discharge(); discharge.setFail(!isCommit); discharge.setTxnId(new Binary(transaction.getTransactionId().array())); message.setBody(new Amqp...
final Message message = Proton.message();
Mono<Void> completeTransaction(AmqpTransaction transaction, boolean isCommit) { final Message message = Proton.message(); Discharge discharge = new Discharge(); discharge.setFail(!isCommit); discharge.setTxnId(new Binary(transaction.getTransactionId().array())); message.setBody(new AmqpValue(discharge)); final int payl...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
`any*()` is used a lot. The messageFormat is deterministic. We know it's a specific format. This makes our tests more tightly scoped.
public void testCreateTransaction() { final String transactionId = "1"; Declared transactionState = new Declared(); transactionState.setTxnId(Binary.create(ByteBuffer.wrap(transactionId.getBytes()))); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono....
doReturn(Mono.just(transactionState)).when(sendLink).send(any(byte[].class), anyInt(), anyInt());
public void testCreateTransaction() { final byte[] transactionId = "1".getBytes(); Declared transactionState = new Declared(); transactionState.setTxnId(Binary.create(ByteBuffer.wrap(transactionId))); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono....
class TransactionCoordinatorTest { @Mock private MessageSerializer messageSerializer; @Mock AmqpSendLink sendLink; @BeforeEach public void setup() throws IOException { MockitoAnnotations.initMocks(this); } @Test public void testCompleteTransaction() { final String transactionId = "1"; Declared transactionState = new De...
class TransactionCoordinatorTest { @Mock private MessageSerializer messageSerializer; @Mock private AmqpSendLink sendLink; @BeforeEach public void setup() { MockitoAnnotations.initMocks(this); } @ParameterizedTest @ValueSource(booleans = {true, false}) public void testCompleteTransactionRejected(boolean isCommit) { fin...
I meant, line 452 onwards to line 463. The only time `Mono<DeliveryState> send` returns is in a success (Accepted/Declared) state.   1. Why return DeliveryState if you already process it rather than `Mono<Void>`?   2. It could be decoupled by returning the `DeliveryState` as-is in `processDeliveredMessage` if   y...
private void processDeliveredMessage(Delivery delivery) { final DeliveryState outcome = delivery.getRemoteState(); final String deliveryTag = new String(delivery.getTag(), UTF_8); logger.verbose("entityPath[{}], linkName[{}], deliveryTag[{}]: process delivered message", entityPath, getLinkName(), deliveryTag); final Re...
if (outcome instanceof Accepted
private void processDeliveredMessage(Delivery delivery) { final DeliveryState outcome = delivery.getRemoteState(); final String deliveryTag = new String(delivery.getTag(), UTF_8); logger.verbose("entityPath[{}], linkName[{}], deliveryTag[{}]: process delivered message", entityPath, getLinkName(), deliveryTag); final Re...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
class ReactorSender implements AmqpSendLink { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; private final ReactorProvider reactorProvider; private final Disposable.Composite subscriptions; private final AtomicBoolean hasConnected = new AtomicBoolean(); private fina...
The ctor already creates an instance of `RetryPolicy`. Is there a reason for creating another instance instead of using `this.retryPolicy`?
protected AmqpSession createSession(String sessionName, Session session, SessionHandler handler) { return new ReactorSession(session, handler, sessionName, reactorProvider, handlerProvider, getClaimsBasedSecurityNode(), tokenManagerProvider, messageSerializer, connectionOptions.getRetry().getTryTimeout(), RetryUtil.get...
connectionOptions.getRetry().getTryTimeout(), RetryUtil.getRetryPolicy(connectionOptions.getRetry()));
protected AmqpSession createSession(String sessionName, Session session, SessionHandler handler) { return new ReactorSession(session, handler, sessionName, reactorProvider, handlerProvider, getClaimsBasedSecurityNode(), tokenManagerProvider, messageSerializer, connectionOptions.getRetry().getTryTimeout(), retryPolicy);...
class ReactorConnection implements AmqpConnection { private static final String CBS_SESSION_NAME = "cbs-session"; private static final String CBS_ADDRESS = "$cbs"; private static final String CBS_LINK_NAME = "cbs"; private final ClientLogger logger = new ClientLogger(ReactorConnection.class); private final ConcurrentMa...
class ReactorConnection implements AmqpConnection { private static final String CBS_SESSION_NAME = "cbs-session"; private static final String CBS_ADDRESS = "$cbs"; private static final String CBS_LINK_NAME = "cbs"; private final ClientLogger logger = new ClientLogger(ReactorConnection.class); private final ConcurrentMa...
Add a log or throw an exception for `default` case instead of leaving it blank.
Mono<AmqpTransaction> createTransaction() { final Message message = Proton.message(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); final int payloadSize = messageSerializer.getSize(message); final int allocationSize = payloadSize + MAX_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[a...
default:
Mono<AmqpTransaction> createTransaction() { final Message message = Proton.message(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); final int payloadSize = messageSerializer.getSize(message); final int allocationSize = payloadSize + MAX_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[a...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
Objects.requireNotNull returns the object. ```java this.transactionId = Objects.requireNonNull(transactionId, "'transactionId' cannot be null."); ```
public AmqpTransaction(ByteBuffer transactionId) { Objects.requireNonNull(transactionId, "'transactionId' cannot be null."); this.transactionId = transactionId; }
this.transactionId = transactionId;
public AmqpTransaction(ByteBuffer transactionId) { this.transactionId = Objects.requireNonNull(transactionId, "'transactionId' cannot be null."); }
class AmqpTransaction { private final ByteBuffer transactionId; /** * Creates {@link AmqpTransaction} given {@code transactionId}. * * @param transactionId for this transaction * * @throws NullPointerException if {@code transactionId} is null. */ /** * Get {@code transactionId} for this transaction. * * @return transac...
class AmqpTransaction { private final ByteBuffer transactionId; /** * Creates {@link AmqpTransaction} given {@code transactionId}. * * @param transactionId The id for this transaction. * * @throws NullPointerException if {@code transactionId} is null. */ /** * Gets the id for this transaction. * * @return The id for th...
Doesn't complete transaction also have some outcomes it should validate?
Mono<Void> completeTransaction(AmqpTransaction transaction, boolean isCommit) { final Message message = Proton.message(); Discharge discharge = new Discharge(); discharge.setFail(!isCommit); discharge.setTxnId(new Binary(transaction.getTransactionId().array())); message.setBody(new AmqpValue(discharge)); final int payl...
if (!(outcome instanceof Accepted)) {
Mono<Void> completeTransaction(AmqpTransaction transaction, boolean isCommit) { final Message message = Proton.message(); Discharge discharge = new Discharge(); discharge.setFail(!isCommit); discharge.setTxnId(new Binary(transaction.getTransactionId().array())); message.setBody(new AmqpValue(discharge)); final int payl...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
Declared can be checked using the DeliveryStateType. If it's not this type, it should fall into the default switch/case. I think this way is messy because there can be many different classes.
Mono<AmqpTransaction> createTransaction() { final Message message = Proton.message(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); final int payloadSize = messageSerializer.getSize(message); final int allocationSize = payloadSize + MAX_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[a...
if (!(outcome instanceof Declared)) {
Mono<AmqpTransaction> createTransaction() { final Message message = Proton.message(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); final int payloadSize = messageSerializer.getSize(message); final int allocationSize = payloadSize + MAX_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[a...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
Scope the returns for your mocks.
public void testCompleteTransactionRejected(boolean isCommit) { final Rejected outcome = new Rejected(); final AmqpTransaction transaction = new AmqpTransaction(ByteBuffer.wrap("1".getBytes())); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono.just(o...
doReturn(Mono.just(outcome)).when(sendLink).send(any(byte[].class), anyInt(), anyInt(), isNull());
public void testCompleteTransactionRejected(boolean isCommit) { final Rejected outcome = new Rejected(); final AmqpTransaction transaction = new AmqpTransaction(ByteBuffer.wrap("1".getBytes())); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono.just(o...
class TransactionCoordinatorTest { @Mock private MessageSerializer messageSerializer; @Mock private AmqpSendLink sendLink; @BeforeEach public void setup() { MockitoAnnotations.initMocks(this); } @MethodSource("commitParams") @ParameterizedTest @MethodSource("commitParams") @ParameterizedTest public void testCompleteTra...
class TransactionCoordinatorTest { @Mock private MessageSerializer messageSerializer; @Mock private AmqpSendLink sendLink; @BeforeEach public void setup() { MockitoAnnotations.initMocks(this); } @ParameterizedTest @ValueSource(booleans = {true, false}) @ParameterizedTest @ValueSource(booleans = {true, false}) public vo...
Do we really need this log message? Also, `txtId` -> transactionId.
Mono<AmqpTransaction> createTransaction() { final Message message = Proton.message(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); final int payloadSize = messageSerializer.getSize(message); final int allocationSize = payloadSize + MAX_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[a...
logger.verbose("Created new TX started: {}", txnId);
Mono<AmqpTransaction> createTransaction() { final Message message = Proton.message(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); final int payloadSize = messageSerializer.getSize(message); final int allocationSize = payloadSize + MAX_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[a...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
Should the default behaviour just be a warning and not an error? the `send` operation will continue to wait for another delivery state message that will never come and hang an application.
Mono<AmqpTransaction> createTransaction() { final Message message = Proton.message(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); final int payloadSize = messageSerializer.getSize(message); final int allocationSize = payloadSize + MAX_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[a...
logger.warning("Unknown DeliveryState type: {}", stateType);
Mono<AmqpTransaction> createTransaction() { final Message message = Proton.message(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); final int payloadSize = messageSerializer.getSize(message); final int allocationSize = payloadSize + MAX_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[a...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
I think doing these instanceof checks are messy, when there is an enum DeliveryStateType we can use.
Mono<Void> completeTransaction(AmqpTransaction transaction, boolean isCommit) { final Message message = Proton.message(); Discharge discharge = new Discharge(); discharge.setFail(!isCommit); discharge.setTxnId(new Binary(transaction.getTransactionId().array())); message.setBody(new AmqpValue(discharge)); final int payl...
if (!(outcome instanceof Accepted)) {
Mono<Void> completeTransaction(AmqpTransaction transaction, boolean isCommit) { final Message message = Proton.message(); Discharge discharge = new Discharge(); discharge.setFail(!isCommit); discharge.setTxnId(new Binary(transaction.getTransactionId().array())); message.setBody(new AmqpValue(discharge)); final int payl...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
You also need a success scenario for this sink.
Mono<Void> completeTransaction(AmqpTransaction transaction, boolean isCommit) { final Message message = Proton.message(); Discharge discharge = new Discharge(); discharge.setFail(!isCommit); discharge.setTxnId(new Binary(transaction.getTransactionId().array())); message.setBody(new AmqpValue(discharge)); final int payl...
if (!(outcome instanceof Accepted)) {
Mono<Void> completeTransaction(AmqpTransaction transaction, boolean isCommit) { final Message message = Proton.message(); Discharge discharge = new Discharge(); discharge.setFail(!isCommit); discharge.setTxnId(new Binary(transaction.getTransactionId().array())); message.setBody(new AmqpValue(discharge)); final int payl...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
class TransactionCoordinator { private final ClientLogger logger = new ClientLogger(TransactionCoordinator.class); private final AmqpSendLink sendLink; private final MessageSerializer messageSerializer; TransactionCoordinator(AmqpSendLink sendLink, MessageSerializer messageSerializer) { this.sendLink = sendLink; this.m...
We're missing tests for using the delivery state on success and not.
public void testSendWithTransaction() { Message message = Proton.message(); message.setMessageId("id"); message.setBody(new AmqpValue("hello")); AmqpTransaction transaction = new AmqpTransaction(ByteBuffer.wrap("1".getBytes())); ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvide...
ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager,
public void testSendWithTransaction() { Message message = Proton.message(); message.setMessageId("id"); message.setBody(new AmqpValue("hello")); ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager, messageSerializer, Duration.ofSeconds(1), new ExponentialAmqpRetryP...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
Or that the transactionDeliveryState is set on a delivery.
public void testSendWithTransaction() { Message message = Proton.message(); message.setMessageId("id"); message.setBody(new AmqpValue("hello")); AmqpTransaction transaction = new AmqpTransaction(ByteBuffer.wrap("1".getBytes())); ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvide...
ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager,
public void testSendWithTransaction() { Message message = Proton.message(); message.setMessageId("id"); message.setBody(new AmqpValue("hello")); ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager, messageSerializer, Duration.ofSeconds(1), new ExponentialAmqpRetryP...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
class ReactorSenderTest { private String entityPath = "entity-path"; @Mock private Sender sender; @Mock private SendLinkHandler handler; @Mock private ReactorProvider reactorProvider; @Mock private TokenManager tokenManager; @Mock private Reactor reactor; @Mock private Selectable selectable; @Mock private MessageSerial...
linkLinkSubscription?
private Mono<AmqpSendLink> createCoordinatorSendLink(Duration timeout, AmqpRetryPolicy retry) { if (isDisposed()) { return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format( "Cannot create coordinator send link '%s' from a closed session.", TRANSACTION_LINK_NAME)))); } final LinkSubscription...
LinkSubscription<AmqpSendLink> linkLinkSubscription = getCoordinator(TRANSACTION_LINK_NAME,
private Mono<AmqpSendLink> createCoordinatorSendLink(Duration timeout, AmqpRetryPolicy retry) { if (isDisposed()) { return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format( "Cannot create coordinator send link '%s' from a closed session.", TRANSACTION_LINK_NAME)))); } final LinkSubscription...
class ReactorSession implements AmqpSession { private static final String TRANSACTION_LINK_NAME = "coordinator"; private final ConcurrentMap<String, LinkSubscription<AmqpSendLink>> openSendLinks = new ConcurrentHashMap<>(); private final ConcurrentMap<String, LinkSubscription<AmqpReceiveLink>> openReceiveLinks = new Co...
class ReactorSession implements AmqpSession { private static final String TRANSACTION_LINK_NAME = "coordinator"; private final ConcurrentMap<String, LinkSubscription<AmqpSendLink>> openSendLinks = new ConcurrentHashMap<>(); private final ConcurrentMap<String, LinkSubscription<AmqpReceiveLink>> openReceiveLinks = new Co...
Would it also be best to change the forEach for formPage, formTable, formTableCell etc into a for loop as well?
public static void main(String[] args) { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildAsyncClient(); String modelId = "{model_Id}"; String filePath = "{file_source_url}"; PollerFlux<OperationResult, List<RecognizedForm>> recogn...
public static void main(String[] args) { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https: .buildAsyncClient(); String modelId = "{model_Id}"; String filePath = "{file_source_url}"; PollerFlux<OperationResult, List<RecognizedForm>> recogn...
class GetBoundingBoxesAsync { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. */ }
class GetBoundingBoxesAsync { /** * Main method to invoke this demo. * * @param args Unused arguments to the program. */ }
I hope these comments are cleaned up before you merge your commits.
void createTransactionAndRollbackMessagesTest(MessagingEntityType entityType) { Duration timeout = Duration.ofSeconds(60); boolean isSessionEnabled = false; setSenderAndReceiver(entityType, isSessionEnabled); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, ...
logger.verbose("!!!! Test Done receiveAndDeleteReceiver.receive ");
void createTransactionAndRollbackMessagesTest(MessagingEntityType entityType) { setSenderAndReceiver(entityType, 0, isSessionEnabled); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); sendMessage(message).block(OPERATION_TIMEOUT); AtomicRe...
class ServiceBusReceiverAsyncClientIntegrationTest extends IntegrationTestBase { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverAsyncClientIntegrationTest.class); private final AtomicInteger messagesPending = new AtomicInteger(); private ServiceBusReceiverAsyncClient receiver; private ServiceBus...
class ServiceBusReceiverAsyncClientIntegrationTest extends IntegrationTestBase { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverAsyncClientIntegrationTest.class); private final AtomicInteger messagesPending = new AtomicInteger(); private ServiceBusReceiverAsyncClient receiver; private ServiceBus...
Yes will do, I am adjusting live test and testing since it is taking longer time specially when transaction rollback, server does not release lock and we have to wait longer for it.
void createTransactionAndRollbackMessagesTest(MessagingEntityType entityType) { Duration timeout = Duration.ofSeconds(60); boolean isSessionEnabled = false; setSenderAndReceiver(entityType, isSessionEnabled); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, ...
logger.verbose("!!!! Test Done receiveAndDeleteReceiver.receive ");
void createTransactionAndRollbackMessagesTest(MessagingEntityType entityType) { setSenderAndReceiver(entityType, 0, isSessionEnabled); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); sendMessage(message).block(OPERATION_TIMEOUT); AtomicRe...
class ServiceBusReceiverAsyncClientIntegrationTest extends IntegrationTestBase { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverAsyncClientIntegrationTest.class); private final AtomicInteger messagesPending = new AtomicInteger(); private ServiceBusReceiverAsyncClient receiver; private ServiceBus...
class ServiceBusReceiverAsyncClientIntegrationTest extends IntegrationTestBase { private final ClientLogger logger = new ClientLogger(ServiceBusReceiverAsyncClientIntegrationTest.class); private final AtomicInteger messagesPending = new AtomicInteger(); private ServiceBusReceiverAsyncClient receiver; private ServiceBus...
Do we not have client side request statistics for query operations ?
public String toString() { if (this.feedResponseDiagnostics != null) { return feedResponseDiagnostics.toString(); } try { return OBJECT_MAPPER.writeValueAsString(this.clientSideRequestStatistics); } catch (JsonProcessingException e) { LOGGER.error("Error while parsing diagnostics " + e); } return StringUtils.EMPTY; }
return feedResponseDiagnostics.toString();
public String toString() { if (this.feedResponseDiagnostics != null) { return feedResponseDiagnostics.toString(); } try { return OBJECT_MAPPER.writeValueAsString(this.clientSideRequestStatistics); } catch (JsonProcessingException e) { LOGGER.error("Error while parsing diagnostics " + e); } return StringUtils.EMPTY; }
class CosmosDiagnostics { private static final Logger LOGGER = LoggerFactory.getLogger(CosmosDiagnostics.class); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private ClientSideRequestStatistics clientSideRequestStatistics; private FeedResponseDiagnostics feedResponseDiagnostics; CosmosDiagnosti...
class CosmosDiagnostics { private static final Logger LOGGER = LoggerFactory.getLogger(CosmosDiagnostics.class); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private ClientSideRequestStatistics clientSideRequestStatistics; private FeedResponseDiagnostics feedResponseDiagnostics; CosmosDiagnosti...
We should also move FeedResponseDiagnostics to implementation package.
public String toString() { if (this.feedResponseDiagnostics != null) { return feedResponseDiagnostics.toString(); } try { return OBJECT_MAPPER.writeValueAsString(this.clientSideRequestStatistics); } catch (JsonProcessingException e) { LOGGER.error("Error while parsing diagnostics " + e); } return StringUtils.EMPTY; }
return feedResponseDiagnostics.toString();
public String toString() { if (this.feedResponseDiagnostics != null) { return feedResponseDiagnostics.toString(); } try { return OBJECT_MAPPER.writeValueAsString(this.clientSideRequestStatistics); } catch (JsonProcessingException e) { LOGGER.error("Error while parsing diagnostics " + e); } return StringUtils.EMPTY; }
class CosmosDiagnostics { private static final Logger LOGGER = LoggerFactory.getLogger(CosmosDiagnostics.class); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private ClientSideRequestStatistics clientSideRequestStatistics; private FeedResponseDiagnostics feedResponseDiagnostics; CosmosDiagnosti...
class CosmosDiagnostics { private static final Logger LOGGER = LoggerFactory.getLogger(CosmosDiagnostics.class); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private ClientSideRequestStatistics clientSideRequestStatistics; private FeedResponseDiagnostics feedResponseDiagnostics; CosmosDiagnosti...
> Do we not have client side request statistics for query operations ? It is inside QueryMetrics type
public String toString() { if (this.feedResponseDiagnostics != null) { return feedResponseDiagnostics.toString(); } try { return OBJECT_MAPPER.writeValueAsString(this.clientSideRequestStatistics); } catch (JsonProcessingException e) { LOGGER.error("Error while parsing diagnostics " + e); } return StringUtils.EMPTY; }
return feedResponseDiagnostics.toString();
public String toString() { if (this.feedResponseDiagnostics != null) { return feedResponseDiagnostics.toString(); } try { return OBJECT_MAPPER.writeValueAsString(this.clientSideRequestStatistics); } catch (JsonProcessingException e) { LOGGER.error("Error while parsing diagnostics " + e); } return StringUtils.EMPTY; }
class CosmosDiagnostics { private static final Logger LOGGER = LoggerFactory.getLogger(CosmosDiagnostics.class); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private ClientSideRequestStatistics clientSideRequestStatistics; private FeedResponseDiagnostics feedResponseDiagnostics; CosmosDiagnosti...
class CosmosDiagnostics { private static final Logger LOGGER = LoggerFactory.getLogger(CosmosDiagnostics.class); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private ClientSideRequestStatistics clientSideRequestStatistics; private FeedResponseDiagnostics feedResponseDiagnostics; CosmosDiagnosti...
This is called ETag elsewhere (see `CosmosAsyncItemResponse.java: public String getETag()`). you Have it as Etag. we should be consistent on this.
private Mono<Document> tryUpdateDocument(AsyncDocumentClient client, String collectionUri, Document document, int index) { BridgeInternal.setProperty(document, "regionId", index); BridgeInternal.setProperty(document, "regionEndpoint", client.getReadEndpoint()); RequestOptions options = new RequestOptions(); options.set...
options.setIfMatchEtag(document.getETag());
private Mono<Document> tryUpdateDocument(AsyncDocumentClient client, String collectionUri, Document document, int index) { BridgeInternal.setProperty(document, "regionId", index); BridgeInternal.setProperty(document, "regionEndpoint", client.getReadEndpoint()); RequestOptions options = new RequestOptions(); options.set...
class ConflictWorker { private static Logger logger = LoggerFactory.getLogger(ConflictWorker.class); private final Scheduler schedulerForBlockingWork; private final List<AsyncDocumentClient> clients; private final String basicCollectionUri; private final String manualCollectionUri; private final String lwwCollectionUri...
class ConflictWorker { private static Logger logger = LoggerFactory.getLogger(ConflictWorker.class); private final Scheduler schedulerForBlockingWork; private final List<AsyncDocumentClient> clients; private final String basicCollectionUri; private final String manualCollectionUri; private final String lwwCollectionUri...
please Fix this in your PR before merging. other than that LGTM.
private Mono<Document> tryUpdateDocument(AsyncDocumentClient client, String collectionUri, Document document, int index) { BridgeInternal.setProperty(document, "regionId", index); BridgeInternal.setProperty(document, "regionEndpoint", client.getReadEndpoint()); RequestOptions options = new RequestOptions(); options.set...
options.setIfMatchEtag(document.getETag());
private Mono<Document> tryUpdateDocument(AsyncDocumentClient client, String collectionUri, Document document, int index) { BridgeInternal.setProperty(document, "regionId", index); BridgeInternal.setProperty(document, "regionEndpoint", client.getReadEndpoint()); RequestOptions options = new RequestOptions(); options.set...
class ConflictWorker { private static Logger logger = LoggerFactory.getLogger(ConflictWorker.class); private final Scheduler schedulerForBlockingWork; private final List<AsyncDocumentClient> clients; private final String basicCollectionUri; private final String manualCollectionUri; private final String lwwCollectionUri...
class ConflictWorker { private static Logger logger = LoggerFactory.getLogger(ConflictWorker.class); private final Scheduler schedulerForBlockingWork; private final List<AsyncDocumentClient> clients; private final String basicCollectionUri; private final String manualCollectionUri; private final String lwwCollectionUri...
Consistency is key.
private Mono<Document> tryUpdateDocument(AsyncDocumentClient client, String collectionUri, Document document, int index) { BridgeInternal.setProperty(document, "regionId", index); BridgeInternal.setProperty(document, "regionEndpoint", client.getReadEndpoint()); RequestOptions options = new RequestOptions(); options.set...
options.setIfMatchEtag(document.getETag());
private Mono<Document> tryUpdateDocument(AsyncDocumentClient client, String collectionUri, Document document, int index) { BridgeInternal.setProperty(document, "regionId", index); BridgeInternal.setProperty(document, "regionEndpoint", client.getReadEndpoint()); RequestOptions options = new RequestOptions(); options.set...
class ConflictWorker { private static Logger logger = LoggerFactory.getLogger(ConflictWorker.class); private final Scheduler schedulerForBlockingWork; private final List<AsyncDocumentClient> clients; private final String basicCollectionUri; private final String manualCollectionUri; private final String lwwCollectionUri...
class ConflictWorker { private static Logger logger = LoggerFactory.getLogger(ConflictWorker.class); private final Scheduler schedulerForBlockingWork; private final List<AsyncDocumentClient> clients; private final String basicCollectionUri; private final String manualCollectionUri; private final String lwwCollectionUri...
Do we need the temp variable?
public static AnalyzeRequest map(com.azure.search.documents.implementation.models.AnalyzeRequest obj) { if (obj == null) { return null; } AnalyzeRequest analyzeRequest = new AnalyzeRequest(); if (obj.getCharFilters() != null) { List<CharFilterName> _charFilters = obj.getCharFilters().stream().map(CharFilterNameConverte...
List<CharFilterName> _charFilters =
public static AnalyzeRequest map(com.azure.search.documents.implementation.models.AnalyzeRequest obj) { if (obj == null) { return null; } AnalyzeRequest analyzeRequest = new AnalyzeRequest(); if (obj.getCharFilters() != null) { List<CharFilterName> charFilters = obj.getCharFilters().stream().map(CharFilterNameConverter...
class AnalyzeRequestConverter { private static final ClientLogger LOGGER = new ClientLogger(AnalyzeRequestConverter.class); /** * Maps from {@link com.azure.search.documents.implementation.models.AnalyzeRequest} to {@link AnalyzeRequest}. */ /** * Maps from {@link AnalyzeRequest} to {@link com.azure.search.documents.im...
class AnalyzeRequestConverter { /** * Maps from {@link com.azure.search.documents.implementation.models.AnalyzeRequest} to {@link AnalyzeRequest}. */ /** * Maps from {@link AnalyzeRequest} to {@link com.azure.search.documents.implementation.models.AnalyzeRequest}. */ public static com.azure.search.documents.implementat...
I have strong concerns about how maintainable this will be if there is API changes in this area.
public static CharFilter map(com.azure.search.documents.implementation.models.CharFilter obj) { if (obj instanceof PatternReplaceCharFilter) { return PatternReplaceCharFilterConverter.map((PatternReplaceCharFilter) obj); } if (obj instanceof MappingCharFilter) { return MappingCharFilterConverter.map((MappingCharFilter)...
if (obj instanceof PatternReplaceCharFilter) {
public static CharFilter map(com.azure.search.documents.implementation.models.CharFilter obj) { if (obj instanceof PatternReplaceCharFilter) { return PatternReplaceCharFilterConverter.map((PatternReplaceCharFilter) obj); } if (obj instanceof MappingCharFilter) { return MappingCharFilterConverter.map((MappingCharFilter)...
class converter. */
class converter. */
This is an enum value, this can be shared between custom and implementation.
public static CjkBigramTokenFilterScripts map(com.azure.search.documents.implementation.models.CjkBigramTokenFilterScripts obj) { if (obj == null) { return null; } switch (obj) { case HAN: return CjkBigramTokenFilterScripts.HAN; case HIRAGANA: return CjkBigramTokenFilterScripts.HIRAGANA; case KATAKANA: return CjkBigram...
return CjkBigramTokenFilterScripts.HAN;
public static CjkBigramTokenFilterScripts map(com.azure.search.documents.implementation.models.CjkBigramTokenFilterScripts obj) { if (obj == null) { return null; } switch (obj) { case HAN: return CjkBigramTokenFilterScripts.HAN; case HIRAGANA: return CjkBigramTokenFilterScripts.HIRAGANA; case KATAKANA: return CjkBigram...
class CjkBigramTokenFilterScriptsConverter { private static final ClientLogger LOGGER = new ClientLogger(CjkBigramTokenFilterScriptsConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.CjkBigramTokenFilterScripts} to enum * {@link CjkBigramTokenFilterScripts}. */ /** * Maps fro...
class CjkBigramTokenFilterScriptsConverter { private static final ClientLogger LOGGER = new ClientLogger(CjkBigramTokenFilterScriptsConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.CjkBigramTokenFilterScripts} to enum * {@link CjkBigramTokenFilterScripts}. */ /** * Maps fro...
Does this class have no properties? Does it really need to have a custom and implementation type?
public static ClassicSimilarity map(com.azure.search.documents.implementation.models.ClassicSimilarity obj) { if (obj == null) { return null; } ClassicSimilarity classicSimilarity = new ClassicSimilarity(); return classicSimilarity; }
ClassicSimilarity classicSimilarity = new ClassicSimilarity();
public static ClassicSimilarity map(com.azure.search.documents.implementation.models.ClassicSimilarity obj) { if (obj == null) { return null; } ClassicSimilarity classicSimilarity = new ClassicSimilarity(); return classicSimilarity; }
class ClassicSimilarityConverter { private static final ClientLogger LOGGER = new ClientLogger(ClassicSimilarityConverter.class); /** * Maps from {@link com.azure.search.documents.implementation.models.ClassicSimilarity} to * {@link ClassicSimilarity}. */ /** * Maps from {@link ClassicSimilarity} to * {@link com.azure....
class ClassicSimilarityConverter { /** * Maps from {@link com.azure.search.documents.implementation.models.ClassicSimilarity} to * {@link ClassicSimilarity}. */ /** * Maps from {@link ClassicSimilarity} to * {@link com.azure.search.documents.implementation.models.ClassicSimilarity}. */ public static com.azure.search.do...
As the other case where we are checking `instanceof`, I have concern about maintainability.
public static CognitiveServicesAccount map(com.azure.search.documents.implementation.models.CognitiveServicesAccount obj) { if (obj instanceof CognitiveServicesAccountKey) { return CognitiveServicesAccountKeyConverter.map((CognitiveServicesAccountKey) obj); } if (obj instanceof DefaultCognitiveServicesAccount) { return...
if (obj instanceof CognitiveServicesAccountKey) {
public static CognitiveServicesAccount map(com.azure.search.documents.implementation.models.CognitiveServicesAccount obj) { if (obj instanceof CognitiveServicesAccountKey) { return CognitiveServicesAccountKeyConverter.map((CognitiveServicesAccountKey) obj); } if (obj instanceof DefaultCognitiveServicesAccount) { return...
class converter. */
class converter. */
Again, concern around maintainability if this area grows.
public static DataChangeDetectionPolicy map(com.azure.search.documents.implementation.models.DataChangeDetectionPolicy obj) { if (obj instanceof HighWaterMarkChangeDetectionPolicy) { return HighWaterMarkChangeDetectionPolicyConverter.map((HighWaterMarkChangeDetectionPolicy) obj); } if (obj instanceof SqlIntegratedChang...
if (obj instanceof HighWaterMarkChangeDetectionPolicy) {
public static DataChangeDetectionPolicy map(com.azure.search.documents.implementation.models.DataChangeDetectionPolicy obj) { if (obj instanceof HighWaterMarkChangeDetectionPolicy) { return HighWaterMarkChangeDetectionPolicyConverter.map((HighWaterMarkChangeDetectionPolicy) obj); } if (obj instanceof SqlIntegratedChang...
class converter. */
class converter. */
Again, concerned about maintainability if this area grows.
public static DataDeletionDetectionPolicy map(com.azure.search.documents.implementation.models.DataDeletionDetectionPolicy obj) { if (obj instanceof SoftDeleteColumnDeletionDetectionPolicy) { return SoftDeleteColumnDeletionDetectionPolicyConverter.map((SoftDeleteColumnDeletionDetectionPolicy) obj); } throw LOGGER.logEx...
if (obj instanceof SoftDeleteColumnDeletionDetectionPolicy) {
public static DataDeletionDetectionPolicy map(com.azure.search.documents.implementation.models.DataDeletionDetectionPolicy obj) { if (obj instanceof SoftDeleteColumnDeletionDetectionPolicy) { return SoftDeleteColumnDeletionDetectionPolicyConverter.map((SoftDeleteColumnDeletionDetectionPolicy) obj); } throw LOGGER.logEx...
class converter. */
class converter. */
Does this need to have both a custom and internal representation? This is a simple credential wrapping class.
public static DataSourceCredentials map(com.azure.search.documents.implementation.models.DataSourceCredentials obj) { if (obj == null) { return null; } DataSourceCredentials dataSourceCredentials = new DataSourceCredentials(); String _connectionString = obj.getConnectionString(); dataSourceCredentials.setConnectionStri...
DataSourceCredentials dataSourceCredentials = new DataSourceCredentials();
public static DataSourceCredentials map(com.azure.search.documents.implementation.models.DataSourceCredentials obj) { if (obj == null) { return null; } DataSourceCredentials dataSourceCredentials = new DataSourceCredentials(); String connectionString = obj.getConnectionString(); dataSourceCredentials.setConnectionStrin...
class DataSourceCredentialsConverter { private static final ClientLogger LOGGER = new ClientLogger(DataSourceCredentialsConverter.class); /** * Maps from {@link com.azure.search.documents.implementation.models.DataSourceCredentials} to * {@link DataSourceCredentials}. */ /** * Maps from {@link DataSourceCredentials} to...
class DataSourceCredentialsConverter { /** * Maps from {@link com.azure.search.documents.implementation.models.DataSourceCredentials} to * {@link DataSourceCredentials}. */ /** * Maps from {@link DataSourceCredentials} to * {@link com.azure.search.documents.implementation.models.DataSourceCredentials}. */ public static...
Given this is an enum does it really need to have a custom and implementation representation?
public static EdgeNGramTokenFilterSide map(com.azure.search.documents.implementation.models.EdgeNGramTokenFilterSide obj) { if (obj == null) { return null; } switch (obj) { case FRONT: return EdgeNGramTokenFilterSide.FRONT; case BACK: return EdgeNGramTokenFilterSide.BACK; default: throw LOGGER.logExceptionAsError(new R...
return EdgeNGramTokenFilterSide.FRONT;
public static EdgeNGramTokenFilterSide map(com.azure.search.documents.implementation.models.EdgeNGramTokenFilterSide obj) { if (obj == null) { return null; } switch (obj) { case FRONT: return EdgeNGramTokenFilterSide.FRONT; case BACK: return EdgeNGramTokenFilterSide.BACK; default: throw LOGGER.logExceptionAsError(new R...
class EdgeNGramTokenFilterSideConverter { private static final ClientLogger LOGGER = new ClientLogger(EdgeNGramTokenFilterSideConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.EdgeNGramTokenFilterSide} to enum * {@link EdgeNGramTokenFilterSide}. */ /** * Maps from enum {@lin...
class EdgeNGramTokenFilterSideConverter { private static final ClientLogger LOGGER = new ClientLogger(EdgeNGramTokenFilterSideConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.EdgeNGramTokenFilterSide} to enum * {@link EdgeNGramTokenFilterSide}. */ /** * Maps from enum {@lin...
Given this is an enum does it really need a custom and implementation representation?
public static EntityCategory map(com.azure.search.documents.implementation.models.EntityCategory obj) { if (obj == null) { return null; } switch (obj) { case LOCATION: return EntityCategory.LOCATION; case ORGANIZATION: return EntityCategory.ORGANIZATION; case PERSON: return EntityCategory.PERSON; case QUANTITY: return ...
return EntityCategory.LOCATION;
public static EntityCategory map(com.azure.search.documents.implementation.models.EntityCategory obj) { if (obj == null) { return null; } switch (obj) { case LOCATION: return EntityCategory.LOCATION; case ORGANIZATION: return EntityCategory.ORGANIZATION; case PERSON: return EntityCategory.PERSON; case QUANTITY: return ...
class EntityCategoryConverter { private static final ClientLogger LOGGER = new ClientLogger(EntityCategoryConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.EntityCategory} to enum * {@link EntityCategory}. */ /** * Maps from enum {@link EntityCategory} to enum * {@link com.a...
class EntityCategoryConverter { private static final ClientLogger LOGGER = new ClientLogger(EntityCategoryConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.EntityCategory} to enum * {@link EntityCategory}. */ /** * Maps from enum {@link EntityCategory} to enum * {@link com.a...
Given this is an enum does it really need a custom and implementation representation?
public static EntityRecognitionSkillLanguage map(com.azure.search.documents.implementation.models.EntityRecognitionSkillLanguage obj) { if (obj == null) { return null; } return EntityRecognitionSkillLanguage.fromString(obj.toString()); }
return EntityRecognitionSkillLanguage.fromString(obj.toString());
public static EntityRecognitionSkillLanguage map(com.azure.search.documents.implementation.models.EntityRecognitionSkillLanguage obj) { if (obj == null) { return null; } return EntityRecognitionSkillLanguage.fromString(obj.toString()); }
class EntityRecognitionSkillLanguageConverter { private static final ClientLogger LOGGER = new ClientLogger(EntityRecognitionSkillLanguageConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.EntityRecognitionSkillLanguage} to enum * {@link EntityRecognitionSkillLanguage}. */ /*...
class EntityRecognitionSkillLanguageConverter { /** * Maps from enum {@link com.azure.search.documents.implementation.models.EntityRecognitionSkillLanguage} to enum * {@link EntityRecognitionSkillLanguage}. */ /** * Maps from enum {@link EntityRecognitionSkillLanguage} to enum * {@link com.azure.search.documents.implem...
Given this is an enum does this really need a custom and implementation representation?
public static ImageAnalysisSkillLanguage map(com.azure.search.documents.implementation.models.ImageAnalysisSkillLanguage obj) { if (obj == null) { return null; } return ImageAnalysisSkillLanguage.fromString(obj.toString()); }
return ImageAnalysisSkillLanguage.fromString(obj.toString());
public static ImageAnalysisSkillLanguage map(com.azure.search.documents.implementation.models.ImageAnalysisSkillLanguage obj) { if (obj == null) { return null; } return ImageAnalysisSkillLanguage.fromString(obj.toString()); }
class ImageAnalysisSkillLanguageConverter { private static final ClientLogger LOGGER = new ClientLogger(ImageAnalysisSkillLanguageConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.ImageAnalysisSkillLanguage} to enum * {@link ImageAnalysisSkillLanguage}. */ /** * Maps from en...
class ImageAnalysisSkillLanguageConverter { /** * Maps from enum {@link com.azure.search.documents.implementation.models.ImageAnalysisSkillLanguage} to enum * {@link ImageAnalysisSkillLanguage}. */ /** * Maps from enum {@link ImageAnalysisSkillLanguage} to enum * {@link com.azure.search.documents.implementation.models....
Given this is an enum does it really need a custom and implementation representation?
public static ImageDetail map(com.azure.search.documents.implementation.models.ImageDetail obj) { if (obj == null) { return null; } switch (obj) { case CELEBRITIES: return ImageDetail.CELEBRITIES; case LANDMARKS: return ImageDetail.LANDMARKS; default: throw LOGGER.logExceptionAsError(new RuntimeException(String.format(...
return ImageDetail.CELEBRITIES;
public static ImageDetail map(com.azure.search.documents.implementation.models.ImageDetail obj) { if (obj == null) { return null; } switch (obj) { case CELEBRITIES: return ImageDetail.CELEBRITIES; case LANDMARKS: return ImageDetail.LANDMARKS; default: throw LOGGER.logExceptionAsError(new RuntimeException(String.format(...
class ImageDetailConverter { private static final ClientLogger LOGGER = new ClientLogger(ImageDetailConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.ImageDetail} to enum {@link ImageDetail}. */ /** * Maps from enum {@link ImageDetail} to enum {@link com.azure.search.documen...
class ImageDetailConverter { private static final ClientLogger LOGGER = new ClientLogger(ImageDetailConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.ImageDetail} to enum {@link ImageDetail}. */ /** * Maps from enum {@link ImageDetail} to enum {@link com.azure.search.documen...
Given this is an enum does it really need a custom and implementation representation?
public static IndexActionType map(com.azure.search.documents.implementation.models.IndexActionType obj) { if (obj == null) { return null; } switch (obj) { case UPLOAD: return IndexActionType.UPLOAD; case MERGE: return IndexActionType.MERGE; case MERGE_OR_UPLOAD: return IndexActionType.MERGE_OR_UPLOAD; case DELETE: retu...
return IndexActionType.UPLOAD;
public static IndexActionType map(com.azure.search.documents.implementation.models.IndexActionType obj) { if (obj == null) { return null; } switch (obj) { case UPLOAD: return IndexActionType.UPLOAD; case MERGE: return IndexActionType.MERGE; case MERGE_OR_UPLOAD: return IndexActionType.MERGE_OR_UPLOAD; case DELETE: retu...
class IndexActionTypeConverter { private static final ClientLogger LOGGER = new ClientLogger(IndexActionTypeConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.IndexActionType} to enum * {@link IndexActionType}. */ /** * Maps from enum {@link IndexActionType} to enum * {@link ...
class IndexActionTypeConverter { private static final ClientLogger LOGGER = new ClientLogger(IndexActionTypeConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.IndexActionType} to enum * {@link IndexActionType}. */ /** * Maps from enum {@link IndexActionType} to enum * {@link ...
Given this is an enum does it really need a custom and implementation representation?
public static IndexerExecutionStatus map(com.azure.search.documents.implementation.models.IndexerExecutionStatus obj) { if (obj == null) { return null; } switch (obj) { case TRANSIENT_FAILURE: return IndexerExecutionStatus.TRANSIENT_FAILURE; case SUCCESS: return IndexerExecutionStatus.SUCCESS; case IN_PROGRESS: return ...
return IndexerExecutionStatus.TRANSIENT_FAILURE;
public static IndexerExecutionStatus map(com.azure.search.documents.implementation.models.IndexerExecutionStatus obj) { if (obj == null) { return null; } switch (obj) { case TRANSIENT_FAILURE: return IndexerExecutionStatus.TRANSIENT_FAILURE; case SUCCESS: return IndexerExecutionStatus.SUCCESS; case IN_PROGRESS: return ...
class IndexerExecutionStatusConverter { private static final ClientLogger LOGGER = new ClientLogger(IndexerExecutionStatusConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.IndexerExecutionStatus} to enum * {@link IndexerExecutionStatus}. */ /** * Maps from enum {@link Indexe...
class IndexerExecutionStatusConverter { private static final ClientLogger LOGGER = new ClientLogger(IndexerExecutionStatusConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.IndexerExecutionStatus} to enum * {@link IndexerExecutionStatus}. */ /** * Maps from enum {@link Indexe...
Given this is an enum does it really need a custom and implementation representation?
public static IndexerStatus map(com.azure.search.documents.implementation.models.IndexerStatus obj) { if (obj == null) { return null; } switch (obj) { case UNKNOWN: return IndexerStatus.UNKNOWN; case ERROR: return IndexerStatus.ERROR; case RUNNING: return IndexerStatus.RUNNING; default: throw LOGGER.logExceptionAsError...
return IndexerStatus.UNKNOWN;
public static IndexerStatus map(com.azure.search.documents.implementation.models.IndexerStatus obj) { if (obj == null) { return null; } switch (obj) { case UNKNOWN: return IndexerStatus.UNKNOWN; case ERROR: return IndexerStatus.ERROR; case RUNNING: return IndexerStatus.RUNNING; default: throw LOGGER.logExceptionAsError...
class IndexerStatusConverter { private static final ClientLogger LOGGER = new ClientLogger(IndexerStatusConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.IndexerStatus} to enum * {@link IndexerStatus}. */ /** * Maps from enum {@link IndexerStatus} to enum * {@link com.azure....
class IndexerStatusConverter { private static final ClientLogger LOGGER = new ClientLogger(IndexerStatusConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.IndexerStatus} to enum * {@link IndexerStatus}. */ /** * Maps from enum {@link IndexerStatus} to enum * {@link com.azure....
Given this is an enum does it really need a custom and implementation representation?
public static KeyPhraseExtractionSkillLanguage map(com.azure.search.documents.implementation.models.KeyPhraseExtractionSkillLanguage obj) { if (obj == null) { return null; } return KeyPhraseExtractionSkillLanguage.fromString(obj.toString()); }
return KeyPhraseExtractionSkillLanguage.fromString(obj.toString());
public static KeyPhraseExtractionSkillLanguage map(com.azure.search.documents.implementation.models.KeyPhraseExtractionSkillLanguage obj) { if (obj == null) { return null; } return KeyPhraseExtractionSkillLanguage.fromString(obj.toString()); }
class KeyPhraseExtractionSkillLanguageConverter { private static final ClientLogger LOGGER = new ClientLogger(KeyPhraseExtractionSkillLanguageConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.KeyPhraseExtractionSkillLanguage} to enum * {@link KeyPhraseExtractionSkillLanguage...
class KeyPhraseExtractionSkillLanguageConverter { /** * Maps from enum {@link com.azure.search.documents.implementation.models.KeyPhraseExtractionSkillLanguage} to enum * {@link KeyPhraseExtractionSkillLanguage}. */ /** * Maps from enum {@link KeyPhraseExtractionSkillLanguage} to enum * {@link com.azure.search.document...
Again, concerns around maintainability if this functional area grows.
public static LexicalAnalyzer map(com.azure.search.documents.implementation.models.LexicalAnalyzer obj) { if (obj instanceof LuceneStandardAnalyzer) { return LuceneStandardAnalyzerConverter.map((LuceneStandardAnalyzer) obj); } if (obj instanceof PatternAnalyzer) { return PatternAnalyzerConverter.map((PatternAnalyzer) o...
if (obj instanceof LuceneStandardAnalyzer) {
public static LexicalAnalyzer map(com.azure.search.documents.implementation.models.LexicalAnalyzer obj) { if (obj instanceof LuceneStandardAnalyzer) { return LuceneStandardAnalyzerConverter.map((LuceneStandardAnalyzer) obj); } if (obj instanceof PatternAnalyzer) { return PatternAnalyzerConverter.map((PatternAnalyzer) o...
class converter. */
class converter. */
Given this is an enum does it really need a custom and implementation representation?
public static LexicalAnalyzerName map(com.azure.search.documents.implementation.models.LexicalAnalyzerName obj) { if (obj == null) { return null; } return LexicalAnalyzerName.fromString(obj.toString()); }
return LexicalAnalyzerName.fromString(obj.toString());
public static LexicalAnalyzerName map(com.azure.search.documents.implementation.models.LexicalAnalyzerName obj) { if (obj == null) { return null; } return LexicalAnalyzerName.fromString(obj.toString()); }
class LexicalAnalyzerNameConverter { private static final ClientLogger LOGGER = new ClientLogger(LexicalAnalyzerNameConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.LexicalAnalyzerName} to enum * {@link LexicalAnalyzerName}. */ /** * Maps from enum {@link LexicalAnalyzerNam...
class LexicalAnalyzerNameConverter { /** * Maps from enum {@link com.azure.search.documents.implementation.models.LexicalAnalyzerName} to enum * {@link LexicalAnalyzerName}. */ /** * Maps from enum {@link LexicalAnalyzerName} to enum * {@link com.azure.search.documents.implementation.models.LexicalAnalyzerName}. */ pub...
Again, concerned about the maintainability of this.
public static LexicalTokenizer map(com.azure.search.documents.implementation.models.LexicalTokenizer obj) { if (obj instanceof PatternTokenizer) { return PatternTokenizerConverter.map((PatternTokenizer) obj); } if (obj instanceof NGramTokenizer) { return NGramTokenizerConverter.map((NGramTokenizer) obj); } if (obj inst...
if (obj instanceof PatternTokenizer) {
public static LexicalTokenizer map(com.azure.search.documents.implementation.models.LexicalTokenizer obj) { if (obj instanceof PatternTokenizer) { return PatternTokenizerConverter.map((PatternTokenizer) obj); } if (obj instanceof NGramTokenizer) { return NGramTokenizerConverter.map((NGramTokenizer) obj); } if (obj inst...
class converter. */
class converter. */
Given that this is an enum does it really need a custom and implementation representation?
public static LexicalTokenizerName map(com.azure.search.documents.implementation.models.LexicalTokenizerName obj) { if (obj == null) { return null; } return LexicalTokenizerName.fromString(obj.toString()); }
return LexicalTokenizerName.fromString(obj.toString());
public static LexicalTokenizerName map(com.azure.search.documents.implementation.models.LexicalTokenizerName obj) { if (obj == null) { return null; } return LexicalTokenizerName.fromString(obj.toString()); }
class LexicalTokenizerNameConverter { private static final ClientLogger LOGGER = new ClientLogger(LexicalTokenizerNameConverter.class); /** * Maps from enum {@link com.azure.search.documents.implementation.models.LexicalTokenizerName} to enum * {@link LexicalTokenizerName}. */ /** * Maps from enum {@link LexicalTokeniz...
class LexicalTokenizerNameConverter { /** * Maps from enum {@link com.azure.search.documents.implementation.models.LexicalTokenizerName} to enum * {@link LexicalTokenizerName}. */ /** * Maps from enum {@link LexicalTokenizerName} to enum * {@link com.azure.search.documents.implementation.models.LexicalTokenizerName}. *...
For any swagger rename, add or delete field properties changes. The code won't compile. Then we need to make a change to the Converter layer. It needs some work compared to previous approach if no change needs to apply.
public static CharFilter map(com.azure.search.documents.implementation.models.CharFilter obj) { if (obj instanceof PatternReplaceCharFilter) { return PatternReplaceCharFilterConverter.map((PatternReplaceCharFilter) obj); } if (obj instanceof MappingCharFilter) { return MappingCharFilterConverter.map((MappingCharFilter)...
if (obj instanceof PatternReplaceCharFilter) {
public static CharFilter map(com.azure.search.documents.implementation.models.CharFilter obj) { if (obj instanceof PatternReplaceCharFilter) { return PatternReplaceCharFilterConverter.map((PatternReplaceCharFilter) obj); } if (obj instanceof MappingCharFilter) { return MappingCharFilterConverter.map((MappingCharFilter)...
class converter. */
class converter. */
Try to leave one comments and resolve the rests
public static DataChangeDetectionPolicy map(com.azure.search.documents.implementation.models.DataChangeDetectionPolicy obj) { if (obj instanceof HighWaterMarkChangeDetectionPolicy) { return HighWaterMarkChangeDetectionPolicyConverter.map((HighWaterMarkChangeDetectionPolicy) obj); } if (obj instanceof SqlIntegratedChang...
if (obj instanceof HighWaterMarkChangeDetectionPolicy) {
public static DataChangeDetectionPolicy map(com.azure.search.documents.implementation.models.DataChangeDetectionPolicy obj) { if (obj instanceof HighWaterMarkChangeDetectionPolicy) { return HighWaterMarkChangeDetectionPolicyConverter.map((HighWaterMarkChangeDetectionPolicy) obj); } if (obj instanceof SqlIntegratedChang...
class converter. */
class converter. */
I have used a way to auto generate the converter. So this is the common format. It does not cause great pain for sdk. I would suggest not tune one by one.
public static AnalyzeRequest map(com.azure.search.documents.implementation.models.AnalyzeRequest obj) { if (obj == null) { return null; } AnalyzeRequest analyzeRequest = new AnalyzeRequest(); if (obj.getCharFilters() != null) { List<CharFilterName> _charFilters = obj.getCharFilters().stream().map(CharFilterNameConverte...
List<CharFilterName> _charFilters =
public static AnalyzeRequest map(com.azure.search.documents.implementation.models.AnalyzeRequest obj) { if (obj == null) { return null; } AnalyzeRequest analyzeRequest = new AnalyzeRequest(); if (obj.getCharFilters() != null) { List<CharFilterName> charFilters = obj.getCharFilters().stream().map(CharFilterNameConverter...
class AnalyzeRequestConverter { private static final ClientLogger LOGGER = new ClientLogger(AnalyzeRequestConverter.class); /** * Maps from {@link com.azure.search.documents.implementation.models.AnalyzeRequest} to {@link AnalyzeRequest}. */ /** * Maps from {@link AnalyzeRequest} to {@link com.azure.search.documents.im...
class AnalyzeRequestConverter { /** * Maps from {@link com.azure.search.documents.implementation.models.AnalyzeRequest} to {@link AnalyzeRequest}. */ /** * Maps from {@link AnalyzeRequest} to {@link com.azure.search.documents.implementation.models.AnalyzeRequest}. */ public static com.azure.search.documents.implementat...