remove deprecated classes (#704)

* remove deprecated classes

Signed-off-by: Mukundan Sundararajan <msundar.ms@outlook.com>

* remove builder class ref in ITs

Signed-off-by: Mukundan Sundararajan <msundar.ms@outlook.com>

* fix setter in IT

Signed-off-by: Mukundan Sundararajan <msundar.ms@outlook.com>
This commit is contained in:
Mukundan Sundararajan 2022-03-15 23:29:12 +05:30 committed by GitHub
parent 904dbe0b18
commit 0b881d3826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 4 additions and 633 deletions

View File

@ -18,7 +18,6 @@ import io.dapr.client.DaprClientBuilder;
import io.dapr.client.domain.CloudEvent;
import io.dapr.client.domain.Metadata;
import io.dapr.client.domain.PublishEventRequest;
import io.dapr.client.domain.PublishEventRequestBuilder;
import java.util.UUID;

View File

@ -17,7 +17,6 @@ import io.dapr.client.DaprClient;
import io.dapr.client.DaprClientBuilder;
import io.dapr.client.domain.HttpExtension;
import io.dapr.client.domain.InvokeMethodRequest;
import io.dapr.client.domain.InvokeMethodRequestBuilder;
import io.dapr.examples.OpenTelemetryConfig;
import io.dapr.utils.TypeRef;
import io.opentelemetry.api.OpenTelemetry;

View File

@ -16,7 +16,6 @@ package io.dapr.examples.tracing;
import io.dapr.client.DaprClient;
import io.dapr.client.domain.HttpExtension;
import io.dapr.client.domain.InvokeMethodRequest;
import io.dapr.client.domain.InvokeMethodRequestBuilder;
import io.dapr.examples.OpenTelemetryInterceptor;
import io.dapr.utils.TypeRef;
import io.opentelemetry.context.Context;

View File

@ -20,7 +20,7 @@ import io.dapr.client.DaprClientBuilder;
import io.dapr.client.domain.CloudEvent;
import io.dapr.client.domain.HttpExtension;
import io.dapr.client.domain.Metadata;
import io.dapr.client.domain.PublishEventRequestBuilder;
import io.dapr.client.domain.PublishEventRequest;
import io.dapr.it.BaseIT;
import io.dapr.it.DaprRun;
import io.dapr.serializer.DaprObjectSerializer;
@ -195,9 +195,8 @@ public class PubSubIT extends BaseIT {
cloudEvent.setDatacontenttype("text/plain");
//Publishing a cloud event.
client.publishEvent(new PublishEventRequestBuilder(PUBSUB_NAME, TOPIC_NAME, cloudEvent)
.withContentType("application/cloudevents+json")
.build()).block();
client.publishEvent(new PublishEventRequest(PUBSUB_NAME, TOPIC_NAME, cloudEvent)
.setContentType("application/cloudevents+json")).block();
System.out.println("Published one cloud event.");
Thread.sleep(3000);

View File

@ -167,8 +167,7 @@
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<!--TODO Switch back coverage on removing the deprecated builder code-->
<minimum>79%</minimum>
<minimum>80%</minimum>
</limit>
</limits>
<excludes>

View File

@ -1,70 +0,0 @@
/*
* Copyright 2021 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/
package io.dapr.client.domain;
import java.util.Collections;
import java.util.Map;
/**
* Builds a request to delete a state by key.
* Deprecated in favor of @see{@link DeleteStateRequest}.
* Deprecated since SDK version 1.3.0, slated for removal in SDK version 1.5.0.
*/
@Deprecated
public class DeleteStateRequestBuilder {
private final String stateStoreName;
private final String key;
private Map<String, String> metadata;
private String etag;
private StateOptions stateOptions;
public DeleteStateRequestBuilder(String stateStoreName, String key) {
this.stateStoreName = stateStoreName;
this.key = key;
}
public DeleteStateRequestBuilder withMetadata(Map<String, String> metadata) {
this.metadata = metadata == null ? null : Collections.unmodifiableMap(metadata);
return this;
}
public DeleteStateRequestBuilder withEtag(String etag) {
this.etag = etag;
return this;
}
public DeleteStateRequestBuilder withStateOptions(StateOptions stateOptions) {
this.stateOptions = stateOptions;
return this;
}
/**
* Builds a request object.
*
* @return Request object.
*/
public DeleteStateRequest build() {
DeleteStateRequest request = new DeleteStateRequest(this.stateStoreName, this.key);
request.setMetadata(metadata);
request.setEtag(this.etag);
request.setStateOptions(this.stateOptions);
return request;
}
}

View File

@ -1,56 +0,0 @@
/*
* Copyright 2021 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/
package io.dapr.client.domain;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* Deprecated in favor of @see{@link ExecuteStateTransactionRequest}.
* Deprecated since SDK version 1.3.0, slated for removal in SDK version 1.5.0.
*/
@Deprecated
public final class ExecuteStateTransactionRequestBuilder {
private final String storeName;
private List<TransactionalStateOperation<?>> transactionalStates;
private Map<String, String> metadata;
public ExecuteStateTransactionRequestBuilder(String storeName) {
this.storeName = storeName;
}
public ExecuteStateTransactionRequestBuilder withTransactionalStates(
TransactionalStateOperation<?>... transactionalStates) {
this.transactionalStates = Collections.unmodifiableList(Arrays.asList(transactionalStates));
return this;
}
public ExecuteStateTransactionRequestBuilder withTransactionalStates(
List<TransactionalStateOperation<?>> transactionalStates) {
this.transactionalStates = transactionalStates == null ? null : Collections.unmodifiableList(transactionalStates);
return this;
}
public ExecuteStateTransactionRequestBuilder withMetadata(Map<String, String> metadata) {
this.metadata = Collections.unmodifiableMap(metadata);
return this;
}
public ExecuteStateTransactionRequest build() {
return new ExecuteStateTransactionRequest(storeName)
.setMetadata(metadata).setOperations(transactionalStates);
}
}

View File

@ -1,50 +0,0 @@
/*
* Copyright 2021 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/
package io.dapr.client.domain;
import java.util.Collections;
import java.util.Map;
/**
* Builds a request to fetch all secrets of a secret store.
* Deprecated in favor of @see{@link GetBulkSecretRequest}.
* Deprecated since SDK version 1.3.0, slated for removal in SDK version 1.5.0.
*/
@Deprecated
public class GetBulkSecretRequestBuilder {
private final String storeName;
private Map<String, String> metadata;
public GetBulkSecretRequestBuilder(String storeName) {
this.storeName = storeName;
}
public GetBulkSecretRequestBuilder withMetadata(Map<String, String> metadata) {
this.metadata = metadata == null ? null : Collections.unmodifiableMap(metadata);
return this;
}
/**
* Builds a request object.
*
* @return Request object.
*/
public GetBulkSecretRequest build() {
GetBulkSecretRequest request = new GetBulkSecretRequest(storeName);
return request.setMetadata(this.metadata);
}
}

View File

@ -1,68 +0,0 @@
/*
* Copyright 2021 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/
package io.dapr.client.domain;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* Builds a request to request states.
* Deprecated in favor of @see{@link GetBulkStateRequest}.
* Deprecated since SDK version 1.3.0, slated for removal in SDK version 1.5.0.
*/
@Deprecated
public class GetBulkStateRequestBuilder {
private final String storeName;
private final List<String> keys;
private Map<String, String> metadata;
private int parallelism = 1;
public GetBulkStateRequestBuilder(String storeName, List<String> keys) {
this.storeName = storeName;
this.keys = keys == null ? null : Collections.unmodifiableList(keys);
}
public GetBulkStateRequestBuilder(String storeName, String... keys) {
this.storeName = storeName;
this.keys = keys == null ? null : Collections.unmodifiableList(Arrays.asList(keys));
}
public GetBulkStateRequestBuilder withMetadata(Map<String, String> metadata) {
this.metadata = metadata == null ? null : Collections.unmodifiableMap(metadata);
return this;
}
public GetBulkStateRequestBuilder withParallelism(int parallelism) {
this.parallelism = parallelism;
return this;
}
/**
* Builds a request object.
*
* @return Request object.
*/
public GetBulkStateRequest build() {
GetBulkStateRequest request = new GetBulkStateRequest(storeName, keys);
return request.setMetadata(this.metadata)
.setParallelism(this.parallelism);
}
}

View File

@ -1,53 +0,0 @@
/*
* Copyright 2021 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/
package io.dapr.client.domain;
import java.util.Collections;
import java.util.Map;
/**
* Builds a request to publish an event.
* Deprecated in favor of @see{@link GetSecretRequest}.
* Deprecated since SDK version 1.3.0, slated for removal in SDK version 1.5.0
*/
@Deprecated
public class GetSecretRequestBuilder {
private final String storeName;
private final String key;
private Map<String, String> metadata;
public GetSecretRequestBuilder(String storeName, String key) {
this.storeName = storeName;
this.key = key;
}
public GetSecretRequestBuilder withMetadata(Map<String, String> metadata) {
this.metadata = metadata == null ? null : Collections.unmodifiableMap(metadata);
return this;
}
/**
* Builds a request object.
*
* @return Request object.
*/
public GetSecretRequest build() {
GetSecretRequest request = new GetSecretRequest(storeName, key);
return request.setMetadata(this.metadata);
}
}

View File

@ -1,61 +0,0 @@
/*
* Copyright 2021 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/
package io.dapr.client.domain;
import java.util.Collections;
import java.util.Map;
/**
* Builds a request to request state.
* Deprecated in favor of @see{@link GetStateRequest}.
* Deprecated since SDK version 1.3.0, slated for removal in SDK version 1.5.0
*/
@Deprecated
public class GetStateRequestBuilder {
private final String storeName;
private final String key;
private Map<String, String> metadata;
private StateOptions stateOptions;
public GetStateRequestBuilder(String storeName, String key) {
this.storeName = storeName;
this.key = key;
}
public GetStateRequestBuilder withMetadata(Map<String, String> metadata) {
this.metadata = metadata == null ? null : Collections.unmodifiableMap(metadata);
return this;
}
public GetStateRequestBuilder withStateOptions(StateOptions stateOptions) {
this.stateOptions = stateOptions;
return this;
}
/**
* Builds a request object.
*
* @return Request object.
*/
public GetStateRequest build() {
GetStateRequest request = new GetStateRequest(storeName, key);
return request.setMetadata(this.metadata)
.setStateOptions(this.stateOptions);
}
}

View File

@ -1,62 +0,0 @@
/*
* Copyright 2021 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/
package io.dapr.client.domain;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* Builds a request to publish an event.
* Deprecated in favor of @see{@link InvokeBindingRequest}.
* Deprecated since SDK version 1.3.0, slated for removal in SDK version 1.5.0
*/
@Deprecated
public class InvokeBindingRequestBuilder {
private final String name;
private final String operation;
private Object data;
private Map<String, String> metadata = new HashMap<>();
public InvokeBindingRequestBuilder(String name, String operation) {
this.name = name;
this.operation = operation;
}
public InvokeBindingRequestBuilder withData(Object data) {
this.data = data;
return this;
}
public InvokeBindingRequestBuilder withMetadata(Map<String, String> metadata) {
this.metadata = metadata == null ? null : Collections.unmodifiableMap(metadata);
return this;
}
/**
* Builds a request object.
*
* @return Request object.
*/
public InvokeBindingRequest build() {
InvokeBindingRequest request = new InvokeBindingRequest(name, operation);
return request.setData(this.data)
.setMetadata(this.metadata);
}
}

View File

@ -1,66 +0,0 @@
/*
* Copyright 2021 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/
package io.dapr.client.domain;
/**
* Builds a request to invoke a service.
* Deprecated in favor of @see{@link InvokeMethodRequest}.
* Deprecated since SDK version 1.3.0, slated for removal in SDK version 1.5.0
*/
@Deprecated
public class InvokeMethodRequestBuilder {
private final String appId;
private final String method;
private String contentType;
private Object body;
private HttpExtension httpExtension = HttpExtension.NONE;
public InvokeMethodRequestBuilder(String appId, String method) {
this.appId = appId;
this.method = method;
}
public InvokeMethodRequestBuilder withContentType(String contentType) {
this.contentType = contentType;
return this;
}
public InvokeMethodRequestBuilder withBody(Object body) {
this.body = body;
return this;
}
public InvokeMethodRequestBuilder withHttpExtension(HttpExtension httpExtension) {
this.httpExtension = httpExtension;
return this;
}
/**
* Builds a request object.
*
* @return Request object.
*/
public InvokeMethodRequest build() {
InvokeMethodRequest request = new InvokeMethodRequest(appId, method);
return request.setBody(this.body)
.setContentType(contentType)
.setHttpExtension(this.httpExtension);
}
}

View File

@ -1,72 +0,0 @@
/*
* Copyright 2021 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/
package io.dapr.client.domain;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* Builds a request to publish an event.
* Deprecated in favor of @see{@link PublishEventRequest}.
* Deprecated since SDK version 1.3.0, slated for removal in SDK version 1.5.0
*/
@Deprecated
public class PublishEventRequestBuilder {
private final String pubsubName;
private final String topic;
private final Object data;
private String contentType;
private Map<String, String> metadata = new HashMap<>();
/**
* Instantiates a builder for a publish request.
*
* @param pubsubName Name of the Dapr PubSub.
* @param topic Topic name.
* @param data Data to be published.
*/
public PublishEventRequestBuilder(String pubsubName, String topic, Object data) {
this.pubsubName = pubsubName;
this.topic = topic;
this.data = data;
}
public PublishEventRequestBuilder withContentType(String contentType) {
this.contentType = contentType;
return this;
}
public PublishEventRequestBuilder withMetadata(Map<String, String> metadata) {
this.metadata = metadata == null ? null : Collections.unmodifiableMap(metadata);
return this;
}
/**
* Builds a request object.
*
* @return Request object.
*/
public PublishEventRequest build() {
PublishEventRequest request = new PublishEventRequest(pubsubName, topic, data);
return request.setContentType(this.contentType)
.setMetadata(this.metadata);
}
}

View File

@ -1,56 +0,0 @@
/*
* Copyright 2021 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/
package io.dapr.client.domain;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* A request to save states to state store.
* Deprecated in favor of @see{@link SaveStateRequest}.
* Deprecated since SDK version 1.3.0, slated for removal in SDK version 1.5.0
*/
@Deprecated
public class SaveStateRequestBuilder {
private final String storeName;
private List<State<?>> states = new ArrayList<>();
public SaveStateRequestBuilder(String storeName) {
this.storeName = storeName;
}
public SaveStateRequestBuilder withStates(State<?>... states) {
this.states = Collections.unmodifiableList(Arrays.asList(states));
return this;
}
public SaveStateRequestBuilder withStates(List<State<?>> states) {
this.states = states == null ? null : Collections.unmodifiableList(states);
return this;
}
/**
* Builds a request object.
*
* @return Request object.
*/
public SaveStateRequest build() {
SaveStateRequest request = new SaveStateRequest(storeName);
return request.setStates(this.states);
}
}

View File

@ -15,7 +15,6 @@ package io.dapr.client;
import io.dapr.client.domain.HttpExtension;
import io.dapr.client.domain.InvokeMethodRequest;
import io.dapr.client.domain.InvokeMethodRequestBuilder;
import io.dapr.serializer.DefaultObjectSerializer;
import io.dapr.utils.TypeRef;
import io.dapr.v1.CommonProtos;

View File

@ -17,16 +17,11 @@ import com.google.protobuf.Any;
import com.google.protobuf.ByteString;
import com.google.protobuf.Empty;
import io.dapr.client.domain.DeleteStateRequest;
import io.dapr.client.domain.DeleteStateRequestBuilder;
import io.dapr.client.domain.ExecuteStateTransactionRequest;
import io.dapr.client.domain.ExecuteStateTransactionRequestBuilder;
import io.dapr.client.domain.GetBulkStateRequest;
import io.dapr.client.domain.GetBulkStateRequestBuilder;
import io.dapr.client.domain.GetStateRequest;
import io.dapr.client.domain.GetStateRequestBuilder;
import io.dapr.client.domain.HttpExtension;
import io.dapr.client.domain.PublishEventRequest;
import io.dapr.client.domain.PublishEventRequestBuilder;
import io.dapr.client.domain.State;
import io.dapr.client.domain.StateOptions;
import io.dapr.client.domain.TransactionalStateOperation;

View File

@ -16,15 +16,11 @@ import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import io.dapr.client.domain.DeleteStateRequest;
import io.dapr.client.domain.DeleteStateRequestBuilder;
import io.dapr.client.domain.GetBulkStateRequest;
import io.dapr.client.domain.GetBulkStateRequestBuilder;
import io.dapr.client.domain.GetStateRequest;
import io.dapr.client.domain.GetStateRequestBuilder;
import io.dapr.client.domain.HttpExtension;
import io.dapr.client.domain.InvokeMethodRequest;
import io.dapr.client.domain.PublishEventRequest;
import io.dapr.client.domain.PublishEventRequestBuilder;
import io.dapr.client.domain.State;
import io.dapr.client.domain.StateOptions;
import io.dapr.client.domain.TransactionalStateOperation;