Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/src/main/java/io/dapr/client/AbstractDaprClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import reactor.core.publisher.Mono;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -91,6 +90,7 @@ public Mono<Void> publishEvent(String pubsubName, String topicName, Object data,
/**
* {@inheritDoc}
*/
@Override
public <T> Mono<T> invokeMethod(
String appId,
String methodName,
Expand Down
3 changes: 1 addition & 2 deletions sdk/src/main/java/io/dapr/client/DaprClientBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@

/**
* A builder for the DaprClient,
* Currently only and HTTP Client will be supported.
* Currently only gRPC and HTTP Client will be supported.
*/

public class DaprClientBuilder {

/**
Expand Down
1 change: 0 additions & 1 deletion sdk/src/main/java/io/dapr/client/DaprClientGrpc.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public class DaprClientGrpc extends AbstractDaprClient {
*/
private DaprGrpc.DaprStub asyncStub;


/**
* Default access level constructor, in order to create an instance of this class use io.dapr.client.DaprClientBuilder
*
Expand Down
1 change: 1 addition & 0 deletions sdk/src/main/java/io/dapr/client/DaprClientHttp.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public Mono<Void> publishEvent(PublishEventRequest request) {
/**
* {@inheritDoc}
*/
@Override
public <T> Mono<T> invokeMethod(InvokeMethodRequest invokeMethodRequest, TypeRef<T> type) {
try {
final String appId = invokeMethodRequest.getAppId();
Expand Down
1 change: 0 additions & 1 deletion sdk/src/main/java/io/dapr/client/domain/CloudEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public CloudEvent(
this.datacontenttype = "application/octet-stream";
this.binaryData = binaryData == null ? null : Arrays.copyOf(binaryData, binaryData.length);;
}


/**
* Deserialize a message topic from Dapr.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* This class is only needed if the app you are calling is listening on HTTP.
* It contains properties that represent data that may be populated for an HTTP receiver.
*/

public final class HttpExtension {
/**
* Convenience HttpExtension object for {@link io.dapr.client.DaprHttp.HttpMethods#NONE} with empty queryString.
Expand Down
16 changes: 7 additions & 9 deletions sdk/src/main/java/io/dapr/client/domain/StateOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,12 @@ public Consistency getConsistency() {
*/
@JsonIgnore
public Map<String, String> getStateOptionsAsMap() {
Map<String, String> mapOptions = null;
if (this != null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, nice catch! This was probably an outcome of some refactoring, I guess.

mapOptions = new HashMap<>();
if (this.getConsistency() != null) {
mapOptions.put("consistency", this.getConsistency().getValue());
}
if (this.getConcurrency() != null) {
mapOptions.put("concurrency", this.getConcurrency().getValue());
}
Map<String, String> mapOptions = new HashMap<>();
if (this.getConsistency() != null) {
mapOptions.put("consistency", this.getConsistency().getValue());
}
if (this.getConcurrency() != null) {
mapOptions.put("concurrency", this.getConcurrency().getValue());
}
return Collections.unmodifiableMap(Optional.ofNullable(mapOptions).orElse(Collections.EMPTY_MAP));
}
Expand Down Expand Up @@ -128,6 +125,7 @@ public void serialize(
}

public static class StateOptionDurationDeserializer extends StdDeserializer<Duration> {

public StateOptionDurationDeserializer(Class<?> vc) {
super(vc);
}
Expand Down
13 changes: 13 additions & 0 deletions sdk/src/test/java/io/dapr/client/DaprClientHttpTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,19 @@ public void getStateWithMetadata() {
assertEquals(monoMetadata.block().getKey(), "key");
}

@Test
public void getStateWithStateOptions() {
StateOptions stateOptions = new StateOptions(StateOptions.Consistency.STRONG, StateOptions.Concurrency.FIRST_WRITE);
mockInterceptor.addRule()
.get("http://127.0.0.1:3000/v1.0/state/MyStateStore/key?consistency=strong&concurrency=first-write")
.respond("\"" + EXPECTED_RESULT + "\"");

GetStateRequestBuilder builder = new GetStateRequestBuilder(STATE_STORE_NAME, "key");
builder.withStateOptions(stateOptions);
Mono<State<String>> monoOptions = daprClientHttp.getState(builder.build(), TypeRef.get(String.class));
assertEquals(monoOptions.block().getKey(), "key");
}

@Test
public void getStatesNullEtag() {
State<String> stateNullEtag = new State<>("key", "value", null, null);
Expand Down