Adding javadocs to some Domain classes (#673)

* Adding javadocs to some Domain classes

Signed-off-by: pravinpushkar <ppushkar@microsoft.com>

* Fixing code coverage

Signed-off-by: pravinpushkar <ppushkar@microsoft.com>

* Incorporating review comments

Signed-off-by: pravinpushkar <ppushkar@microsoft.com>
This commit is contained in:
Pravin Pushkar 2022-01-27 16:30:49 +05:30 committed by GitHub
parent 3e5fe39933
commit 9989832b56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 97 additions and 0 deletions

View File

@ -31,6 +31,12 @@ public class DeleteStateRequest {
private StateOptions stateOptions;
/**
* Constructor for DeleteStateRequest.
*
* @param storeName Name of the state store
* @param key Key present in the state store
*/
public DeleteStateRequest(String storeName, String key) {
this.stateStoreName = storeName;
this.key = key;

View File

@ -17,6 +17,9 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* A request for executing state transaction operations.
*/
public class ExecuteStateTransactionRequest {
/**
@ -34,6 +37,11 @@ public class ExecuteStateTransactionRequest {
*/
private Map<String, String> metadata;
/**
* Constructor for ExecuteStateTransactionRequest.
*
* @param stateStoreName Name of the state store
*/
public ExecuteStateTransactionRequest(String stateStoreName) {
this.stateStoreName = stateStoreName;
}

View File

@ -25,6 +25,11 @@ public class GetBulkSecretRequest {
private Map<String, String> metadata;
/**
* Constructor for GetBulkSecretRequest.
*
* @param storeName Name of the secret store
*/
public GetBulkSecretRequest(String storeName) {
this.storeName = storeName;
}

View File

@ -31,6 +31,12 @@ public class GetBulkStateRequest {
private int parallelism = 1;
/**
* Constructor for GetBulkStateRequest.
*
* @param storeName Name of the state store
* @param keys keys for the state objects
*/
public GetBulkStateRequest(String storeName, List<String> keys) {
this.storeName = storeName;
this.keys = keys == null ? null : Collections.unmodifiableList(keys);

View File

@ -25,6 +25,12 @@ public class GetConfigurationRequest {
private final List<String> keys;
private Map<String, String> metadata;
/**
* Constructor for GetConfigurationRequest.
*
* @param storeName Name of the configuration store
* @param keys Keys for the configuration objects
*/
public GetConfigurationRequest(String storeName, List<String> keys) {
this.storeName = storeName;
this.keys = keys == null ? Collections.EMPTY_LIST : Collections.unmodifiableList(keys);

View File

@ -25,6 +25,12 @@ public class GetSecretRequest {
private final String key;
/**
* Constructor for GetSecretRequest.
*
* @param storeName Name of the Secret Store
* @param key Key for retrieving the secret
*/
public GetSecretRequest(String storeName, String key) {
this.storeName = storeName;
this.key = key;

View File

@ -29,6 +29,12 @@ public class GetStateRequest {
private StateOptions stateOptions;
/**
* Constructor for GetStateRequest.
*
* @param storeName Name of the state store
* @param key Key of the state object
*/
public GetStateRequest(String storeName, String key) {
this.storeName = storeName;
this.key = key;

View File

@ -29,6 +29,12 @@ public class InvokeBindingRequest {
private Map<String, String> metadata;
/**
* Constructor for InvokeBindingRequest.
*
* @param bindingName Name of the binding
* @param operation Name of the binding operation
*/
public InvokeBindingRequest(String bindingName, String operation) {
this.name = bindingName;
this.operation = operation;

View File

@ -28,6 +28,12 @@ public class InvokeMethodRequest {
private String contentType;
/**
* Constructor for InvokeMethodRequest.
*
* @param appId ID of the Dapr application
* @param method Name of the method to be invoked
*/
public InvokeMethodRequest(String appId, String method) {
this.appId = appId;
this.method = method;

View File

@ -26,6 +26,11 @@ public class SaveStateRequest {
private List<State<?>> states;
/**
* Constructor for SaveStateRequest.
*
* @param storeName Name of the state store
*/
public SaveStateRequest(String storeName) {
this.storeName = storeName;
}

View File

@ -32,6 +32,9 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
/**
* A class representing the state options for Dapr state API.
*/
public class StateOptions {
private final Consistency consistency;
private final Concurrency concurrency;
@ -70,6 +73,9 @@ public class StateOptions {
return Collections.unmodifiableMap(Optional.ofNullable(mapOptions).orElse(Collections.EMPTY_MAP));
}
/**
* Options for Consistency.
*/
public enum Consistency {
EVENTUAL("eventual"),
STRONG("strong");
@ -91,6 +97,9 @@ public class StateOptions {
}
}
/**
* Options for Concurrency.
*/
public enum Concurrency {
FIRST_WRITE("first-write"),
LAST_WRITE("last-write");

View File

@ -25,6 +25,12 @@ public class SubscribeConfigurationRequest {
private final List<String> keys;
private Map<String, String> metadata;
/**
* Constructor for SubscribeConfigurationRequest.
*
* @param storeName Name of the configuration store
* @param keys Keys of the configurations values to subscribe to
*/
public SubscribeConfigurationRequest(String storeName, List<String> keys) {
this.storeName = storeName;
this.keys = keys == null ? Collections.EMPTY_LIST : Collections.unmodifiableList(keys);

View File

@ -17,6 +17,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
/**
* Class to represent transactional state operations.
* @param <T> Type of the state value
*/
public class TransactionalStateOperation<T> {
/**
@ -73,6 +77,9 @@ public class TransactionalStateOperation<T> {
+ '}';
}
/**
* Options for type of operation.
*/
public enum OperationType {
@JsonProperty("upsert") UPSERT,
@JsonProperty("delete") DELETE

View File

@ -17,6 +17,10 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* A class to represent request for transactional state.
* @param <T> Type of state value in TransactionalStateOperation
*/
public class TransactionalStateRequest<T> {
/**

View File

@ -15,6 +15,8 @@ package io.dapr.client;
import io.dapr.client.domain.ConfigurationItem;
import io.dapr.client.domain.GetConfigurationRequest;
import io.dapr.client.domain.SubscribeConfigurationRequest;
import io.dapr.serializer.DefaultObjectSerializer;
import io.dapr.v1.CommonProtos;
import io.dapr.v1.DaprGrpc;
@ -73,6 +75,10 @@ public class DaprPreviewClientGrpcTest {
assertThrows(IllegalArgumentException.class, () -> {
previewClient.getConfiguration("", "key").block();
});
GetConfigurationRequest req = new GetConfigurationRequest(CONFIG_STORE_NAME, null);
assertThrows(IllegalArgumentException.class, () -> {
previewClient.getConfiguration(req).block();
});
}
@Test
@ -223,6 +229,11 @@ public class DaprPreviewClientGrpcTest {
assertThrows(IllegalArgumentException.class, () -> {
previewClient.subscribeToConfiguration("", "key").blockFirst();
});
SubscribeConfigurationRequest req = new SubscribeConfigurationRequest(CONFIG_STORE_NAME, null);
assertThrows(IllegalArgumentException.class, () -> {
previewClient.subscribeToConfiguration(req).blockFirst();
});
}
private DaprProtos.GetConfigurationResponse getSingleMockResponse() {