Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dataspace-protocol add missing fields to TransferTerminationMessage #2777

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
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ void notifyTerminated_shouldTransitionToTerminated() {
.protocol("protocol")
.callbackAddress("http://any")
.processId("dataRequestId")
.code("TestCode")
.reason("TestReason")
.build();

var result = service.notifyTerminated(message, claimToken());
Expand All @@ -264,6 +266,8 @@ void notifyTerminated_shouldReturnConflict_whenStatusIsNotValid() {
.protocol("protocol")
.callbackAddress("http://any")
.processId("dataRequestId")
.code("TestCode")
.reason("TestReason")
.build();

var result = service.notifyTerminated(message, claimToken());
Expand Down Expand Up @@ -299,7 +303,8 @@ public Stream<? extends Arguments> provideArguments(ExtensionContext extensionCo
Arguments.of(completed, TransferCompletionMessage.Builder.newInstance().protocol("protocol")
.callbackAddress("http://any").processId("dataRequestId").build()),
Arguments.of(terminated, TransferTerminationMessage.Builder.newInstance().protocol("protocol")
.callbackAddress("http://any").processId("dataRequestId").build())
.callbackAddress("http://any").processId("dataRequestId").code("TestCode")
.reason("TestReason").build())
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ void shouldNotSendTransferTerminationMessage() {
var message = TransferTerminationMessage.Builder.newInstance()
.protocol("ids-multipart")
.processId("processId")
.code("TestCode")
.reason("TestReason")
.build();

var future = dispatcher.send(Object.class, message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public class TransferTerminationMessage implements TransferRemoteMessage {
private String protocol;
private String processId;

private String code;

private String reason; //TODO change to List https://github.com/eclipse-edc/Connector/issues/2729

@Override
public String getProtocol() {
return protocol;
Expand All @@ -45,6 +49,14 @@ public String getProcessId() {
return processId;
}

public String getCode() {
return code;
}

public String getReason() {
return reason;
}

@JsonPOJOBuilder(withPrefix = "")
public static class Builder {
private final TransferTerminationMessage message;
Expand Down Expand Up @@ -73,6 +85,16 @@ public Builder processId(String processId) {
return this;
}

public Builder code(String code) {
message.code = code;
return this;
}

public Builder reason(String reason) {
message.reason = reason;
return this;
}

public TransferTerminationMessage build() {
Objects.requireNonNull(message.protocol, "The protocol must be specified");
Objects.requireNonNull(message.processId, "The processId must be specified");
Expand Down