mirror of https://github.com/dapr/java-sdk.git
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:
parent
3e5fe39933
commit
9989832b56
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue