Skip to content

Commit b4af644

Browse files
committed
docs: add claims
1 parent 32c4417 commit b4af644

11 files changed

Lines changed: 67 additions & 90 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
}
99

1010
group = "org.eclipse.dataplane-core"
11-
version = "0.0.9-SNAPSHOT"
11+
version = "0.0.10-SNAPSHOT"
1212

1313
repositories {
1414
mavenCentral()

src/main/java/org/eclipse/dataplane/domain/dataflow/DataFlowPrepareMessage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public record DataFlowPrepareMessage(
2828
String datasetId,
2929
URI callbackAddress,
3030
String transferType,
31+
Map<String, Object> claims,
3132
List<String> labels,
3233
Map<String, Object> metadata
3334
) {

src/main/java/org/eclipse/dataplane/domain/dataflow/DataFlowStartMessage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public record DataFlowStartMessage(
3131
URI callbackAddress,
3232
String transferType,
3333
DataAddress dataAddress,
34+
Map<String, Object> claims,
3435
List<String> labels,
3536
Map<String, Object> metadata
3637
) {

src/test/java/org/eclipse/dataplane/DataplaneTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
4141
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
4242
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
43-
import static java.util.Collections.emptyList;
44-
import static java.util.Collections.emptyMap;
4543
import static org.assertj.core.api.Assertions.assertThat;
4644
import static org.assertj.core.api.Assertions.assertThatThrownBy;
4745
import static org.eclipse.dataplane.domain.dataflow.DataFlow.State.COMPLETED;
@@ -198,7 +196,6 @@ void shouldFail_whenStatusIsNot200() {
198196
}
199197

200198
private DataFlowPrepareMessage createPrepareMessage() {
201-
return new DataFlowPrepareMessage("any", "any", "any", "any", "dataFlowId", "any", "any",
202-
URI.create(controlPlane.baseUrl()), "Something-PUSH", emptyList(), emptyMap());
199+
return MessageFactory.createPrepareMessage("dataFlowId", URI.create(controlPlane.baseUrl()), "Something-PUSH");
203200
}
204201
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (c) 2026 Think-it GmbH
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Apache License, Version 2.0 which is available at
6+
* https://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* SPDX-License-Identifier: Apache-2.0
9+
*
10+
* Contributors:
11+
* Think-it GmbH - initial API and implementation
12+
*
13+
*/
14+
15+
package org.eclipse.dataplane;
16+
17+
import org.eclipse.dataplane.domain.DataAddress;
18+
import org.eclipse.dataplane.domain.dataflow.DataFlowPrepareMessage;
19+
import org.eclipse.dataplane.domain.dataflow.DataFlowStartMessage;
20+
import org.jspecify.annotations.NonNull;
21+
22+
import java.net.URI;
23+
24+
import static java.util.Collections.emptyList;
25+
import static java.util.Collections.emptyMap;
26+
27+
public interface MessageFactory {
28+
29+
static @NonNull DataFlowPrepareMessage createPrepareMessage(String consumerProcessId, URI callbackAddress, String transferType) {
30+
return new DataFlowPrepareMessage("theMessageId", "theParticipantId", "theCounterPartyId",
31+
"theDataspaceContext", consumerProcessId, "theAgreementId", "theDatasetId", callbackAddress,
32+
transferType, emptyMap(), emptyList(), emptyMap());
33+
}
34+
35+
static @NonNull DataFlowStartMessage createStartMessage(String providerProcessId, URI callbackAddress, String transferType) {
36+
return createStartMessage(providerProcessId, callbackAddress, transferType, null);
37+
}
38+
39+
static @NonNull DataFlowStartMessage createStartMessage(String providerProcessId, URI callbackAddress, String transferType, DataAddress destinationDataAddress) {
40+
return new DataFlowStartMessage("theMessageId", "theParticipantId", "theCounterPartyId",
41+
"theDataspaceContext", providerProcessId, "theAgreementId", "theDatasetId", callbackAddress,
42+
transferType, destinationDataAddress, emptyMap(), emptyList(), emptyMap());
43+
}
44+
}

src/test/java/org/eclipse/dataplane/scenario/AuthorizationOauth2Test.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,23 @@
3131
import org.eclipse.dataplane.Dataplane;
3232
import org.eclipse.dataplane.HttpServer;
3333
import org.eclipse.dataplane.domain.Result;
34-
import org.eclipse.dataplane.domain.dataflow.DataFlowPrepareMessage;
3534
import org.eclipse.dataplane.domain.dataflow.DataFlowStatusMessage;
3635
import org.eclipse.dataplane.domain.registration.AuthorizationProfile;
3736
import org.eclipse.dataplane.domain.registration.ControlPlaneRegistrationMessage;
3837
import org.eclipse.dataplane.domain.registration.Oauth2ClientCredentialsAuthorization;
39-
import org.jspecify.annotations.NonNull;
4038
import org.junit.jupiter.api.AfterEach;
4139
import org.junit.jupiter.api.BeforeEach;
4240
import org.junit.jupiter.api.Test;
4341

44-
import java.net.URI;
4542
import java.util.Date;
4643
import java.util.Map;
4744
import java.util.Objects;
4845
import java.util.UUID;
4946

5047
import static jakarta.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED;
5148
import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON;
52-
import static java.util.Collections.emptyList;
53-
import static java.util.Collections.emptyMap;
5449
import static org.assertj.core.api.Assertions.assertThat;
50+
import static org.eclipse.dataplane.MessageFactory.createPrepareMessage;
5551

5652
public class AuthorizationOauth2Test {
5753

@@ -119,12 +115,6 @@ void shouldCommunicateWithControlPlaneUsingOauth2Authorization() {
119115
assertThat(notifyPreparedResult.succeeded()).isTrue();
120116
}
121117

122-
private @NonNull DataFlowPrepareMessage createPrepareMessage(String consumerProcessId, URI callbackAddress, String transferType) {
123-
return new DataFlowPrepareMessage("theMessageId", "theParticipantId", "theCounterPartyId",
124-
"theDataspaceContext", consumerProcessId, "theAgreementId", "theDatasetId", callbackAddress,
125-
transferType, emptyList(), emptyMap());
126-
}
127-
128118
private AuthorizationProfile oauth2AuthorizationProfile() {
129119
return new AuthorizationProfile("oauth2_client_credentials")
130120
.withAttribute("tokenEndpoint", "http://localhost:" + httpServer.port() + "/oauth2/token")

src/test/java/org/eclipse/dataplane/scenario/AuthorizationTest.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,17 @@
1919
import org.eclipse.dataplane.HttpServer;
2020
import org.eclipse.dataplane.authorization.TestAuthorization;
2121
import org.eclipse.dataplane.domain.Result;
22-
import org.eclipse.dataplane.domain.dataflow.DataFlowPrepareMessage;
2322
import org.eclipse.dataplane.domain.dataflow.DataFlowStatusMessage;
2423
import org.eclipse.dataplane.domain.registration.ControlPlaneRegistrationMessage;
2524
import org.eclipse.dataplane.port.exception.DataFlowNotifyControlPlaneFailed;
26-
import org.jspecify.annotations.NonNull;
2725
import org.junit.jupiter.api.AfterEach;
2826
import org.junit.jupiter.api.BeforeEach;
2927
import org.junit.jupiter.api.Test;
3028

31-
import java.net.URI;
3229
import java.util.UUID;
3330

34-
import static java.util.Collections.emptyList;
35-
import static java.util.Collections.emptyMap;
3631
import static org.assertj.core.api.Assertions.assertThat;
32+
import static org.eclipse.dataplane.MessageFactory.createPrepareMessage;
3733
import static org.eclipse.dataplane.authorization.TestAuthorization.TOKEN_GENERATOR;
3834

3935
public class AuthorizationTest {
@@ -130,10 +126,4 @@ void shouldGetUnauthorized_withDataPlaneIsNotAuthenticated() {
130126
});
131127
}
132128

133-
private @NonNull DataFlowPrepareMessage createPrepareMessage(String consumerProcessId, URI callbackAddress, String transferType) {
134-
return new DataFlowPrepareMessage("theMessageId", "theParticipantId", "theCounterPartyId",
135-
"theDataspaceContext", consumerProcessId, "theAgreementId", "theDatasetId", callbackAddress,
136-
transferType, emptyList(), emptyMap());
137-
}
138-
139129
}

src/test/java/org/eclipse/dataplane/scenario/ConsumerPullTest.java

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,10 @@
2121
import org.eclipse.dataplane.domain.DataAddress;
2222
import org.eclipse.dataplane.domain.Result;
2323
import org.eclipse.dataplane.domain.dataflow.DataFlow;
24-
import org.eclipse.dataplane.domain.dataflow.DataFlowPrepareMessage;
25-
import org.eclipse.dataplane.domain.dataflow.DataFlowStartMessage;
2624
import org.eclipse.dataplane.domain.dataflow.DataFlowStartedNotificationMessage;
2725
import org.eclipse.dataplane.domain.dataflow.DataFlowStatusMessage;
2826
import org.eclipse.dataplane.domain.dataflow.DataFlowStatusResponseMessage;
2927
import org.eclipse.dataplane.domain.registration.ControlPlaneRegistrationMessage;
30-
import org.jspecify.annotations.NonNull;
3128
import org.junit.jupiter.api.AfterEach;
3229
import org.junit.jupiter.api.BeforeEach;
3330
import org.junit.jupiter.api.Test;
@@ -41,9 +38,10 @@
4138
import java.util.UUID;
4239

4340
import static java.util.Collections.emptyList;
44-
import static java.util.Collections.emptyMap;
4541
import static org.assertj.core.api.Assertions.assertThat;
4642
import static org.awaitility.Awaitility.await;
43+
import static org.eclipse.dataplane.MessageFactory.createPrepareMessage;
44+
import static org.eclipse.dataplane.MessageFactory.createStartMessage;
4745
import static org.eclipse.dataplane.authorization.TestAuthorization.TOKEN_GENERATOR;
4846
import static org.eclipse.dataplane.authorization.TestAuthorization.createAuthorizationProfile;
4947
import static org.eclipse.dataplane.domain.dataflow.DataFlow.State.PREPARED;
@@ -80,14 +78,14 @@ void shouldPullDataFromProvider() {
8078
var transferType = "FileSystem-PULL";
8179
var processId = UUID.randomUUID().toString();
8280
var consumerProcessId = "consumer_" + processId;
83-
var prepareMessage = createPrepareMessage(consumerProcessId, transferType);
81+
var prepareMessage = createPrepareMessage(consumerProcessId, controlPlane.consumerCallbackAddress(), transferType);
8482

8583
var prepareResponse = controlPlane.consumerPrepare(prepareMessage).statusCode(200).extract().as(DataFlowStatusMessage.class);
8684
assertThat(prepareResponse.state()).isEqualTo(PREPARED.name());
8785
assertThat(prepareResponse.dataAddress()).isNull();
8886

8987
var providerProcessId = "provider_" + processId;
90-
var startMessage = createStartMessage(providerProcessId, transferType);
88+
var startMessage = createStartMessage(providerProcessId, controlPlane.providerCallbackAddress(), transferType);
9189
var startResponse = controlPlane.providerStart(startMessage).statusCode(200).extract().as(DataFlowStatusMessage.class);
9290
assertThat(startResponse.state()).isEqualTo(STARTED.name());
9391
assertThat(startResponse.dataAddress()).isNotNull();
@@ -104,11 +102,11 @@ void shouldPermitAsyncStartup() {
104102
var transferType = "FileSystemAsync-PULL";
105103
var processId = UUID.randomUUID().toString();
106104
var consumerProcessId = "consumer_" + processId;
107-
var prepareMessage = createPrepareMessage(consumerProcessId, transferType);
105+
var prepareMessage = createPrepareMessage(consumerProcessId, controlPlane.consumerCallbackAddress(), transferType);
108106
controlPlane.consumerPrepare(prepareMessage).statusCode(200).extract().as(DataFlowStatusMessage.class);
109107

110108
var providerProcessId = "provider_" + processId;
111-
var startMessage = createStartMessage(providerProcessId, transferType);
109+
var startMessage = createStartMessage(providerProcessId, controlPlane.providerCallbackAddress(), transferType);
112110
var startResponse = controlPlane.providerStart(startMessage).statusCode(202).extract().as(DataFlowStatusMessage.class);
113111
assertThat(startResponse.state()).isEqualTo(STARTING.name());
114112
assertThat(startResponse.dataAddress()).isNull();
@@ -119,18 +117,6 @@ void shouldPermitAsyncStartup() {
119117
.isEqualTo(STARTED.name());
120118
}
121119

122-
private @NonNull DataFlowStartMessage createStartMessage(String providerProcessId, String transferType) {
123-
return new DataFlowStartMessage("theMessageId", "theParticipantId", "theCounterPartyId",
124-
"theDataspaceContext", providerProcessId, "theAgreementId", "theDatasetId", controlPlane.providerCallbackAddress(),
125-
transferType, null, emptyList(), emptyMap());
126-
}
127-
128-
private @NonNull DataFlowPrepareMessage createPrepareMessage(String consumerProcessId, String transferType) {
129-
return new DataFlowPrepareMessage("theMessageId", "theParticipantId", "theCounterPartyId",
130-
"theDataspaceContext", consumerProcessId, "theAgreementId", "theDatasetId", controlPlane.consumerCallbackAddress(),
131-
transferType, emptyList(), emptyMap());
132-
}
133-
134120
private class ConsumerDataPlane {
135121

136122
private final Path storage;

src/test/java/org/eclipse/dataplane/scenario/ProviderPushTest.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import org.eclipse.dataplane.domain.DataAddress;
2222
import org.eclipse.dataplane.domain.Result;
2323
import org.eclipse.dataplane.domain.dataflow.DataFlow;
24-
import org.eclipse.dataplane.domain.dataflow.DataFlowPrepareMessage;
25-
import org.eclipse.dataplane.domain.dataflow.DataFlowStartMessage;
2624
import org.eclipse.dataplane.domain.dataflow.DataFlowStatusMessage;
2725
import org.eclipse.dataplane.domain.dataflow.DataFlowStatusResponseMessage;
2826
import org.eclipse.dataplane.domain.registration.ControlPlaneRegistrationMessage;
@@ -41,9 +39,10 @@
4139
import java.util.concurrent.Executors;
4240

4341
import static java.util.Collections.emptyList;
44-
import static java.util.Collections.emptyMap;
4542
import static org.assertj.core.api.Assertions.assertThat;
4643
import static org.awaitility.Awaitility.await;
44+
import static org.eclipse.dataplane.MessageFactory.createPrepareMessage;
45+
import static org.eclipse.dataplane.MessageFactory.createStartMessage;
4746
import static org.eclipse.dataplane.authorization.TestAuthorization.TOKEN_GENERATOR;
4847
import static org.eclipse.dataplane.authorization.TestAuthorization.createAuthorizationProfile;
4948
import static org.eclipse.dataplane.domain.dataflow.DataFlow.State.COMPLETED;
@@ -148,18 +147,6 @@ void shouldPermitAsyncPreparation() {
148147
.isEqualTo(PREPARED.name());
149148
}
150149

151-
private @NonNull DataFlowStartMessage createStartMessage(String providerProcessId, URI callbackAddress, String transferType, DataAddress destinationDataAddress) {
152-
return new DataFlowStartMessage("theMessageId", "theParticipantId", "theCounterPartyId",
153-
"theDataspaceContext", providerProcessId, "theAgreementId", "theDatasetId", callbackAddress,
154-
transferType, destinationDataAddress, emptyList(), emptyMap());
155-
}
156-
157-
private @NonNull DataFlowPrepareMessage createPrepareMessage(String consumerProcessId, URI callbackAddress, String transferType) {
158-
return new DataFlowPrepareMessage("theMessageId", "theParticipantId", "theCounterPartyId",
159-
"theDataspaceContext", consumerProcessId, "theAgreementId", "theDatasetId", callbackAddress,
160-
transferType, emptyList(), emptyMap());
161-
}
162-
163150
private static class ProviderDataPlane {
164151

165152
private final ExecutorService executor = Executors.newCachedThreadPool();

src/test/java/org/eclipse/dataplane/scenario/StreamingPullTest.java

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
import org.eclipse.dataplane.domain.DataAddress;
2323
import org.eclipse.dataplane.domain.Result;
2424
import org.eclipse.dataplane.domain.dataflow.DataFlow;
25-
import org.eclipse.dataplane.domain.dataflow.DataFlowPrepareMessage;
2625
import org.eclipse.dataplane.domain.dataflow.DataFlowResumeMessage;
27-
import org.eclipse.dataplane.domain.dataflow.DataFlowStartMessage;
2826
import org.eclipse.dataplane.domain.dataflow.DataFlowStartedNotificationMessage;
2927
import org.eclipse.dataplane.domain.dataflow.DataFlowStatusMessage;
3028
import org.eclipse.dataplane.domain.dataflow.DataFlowSuspendMessage;
@@ -49,9 +47,10 @@
4947
import java.util.concurrent.TimeUnit;
5048

5149
import static java.util.Collections.emptyList;
52-
import static java.util.Collections.emptyMap;
5350
import static org.assertj.core.api.Assertions.assertThat;
5451
import static org.awaitility.Awaitility.await;
52+
import static org.eclipse.dataplane.MessageFactory.createPrepareMessage;
53+
import static org.eclipse.dataplane.MessageFactory.createStartMessage;
5554
import static org.eclipse.dataplane.authorization.TestAuthorization.TOKEN_GENERATOR;
5655
import static org.eclipse.dataplane.authorization.TestAuthorization.createAuthorizationProfile;
5756
import static org.eclipse.dataplane.domain.dataflow.DataFlow.State.PREPARED;
@@ -86,14 +85,14 @@ void shouldPullDataFromProvider_thenProviderTerminatesIt() {
8685
var transferType = "FileSystemStreaming-PULL";
8786
var processId = UUID.randomUUID().toString();
8887
var consumerProcessId = "consumer_" + processId;
89-
var prepareMessage = prepareMessage(consumerProcessId, transferType);
88+
var prepareMessage = createPrepareMessage(consumerProcessId, controlPlane.consumerCallbackAddress(), transferType);
9089

9190
var prepareResponse = controlPlane.consumerPrepare(prepareMessage).statusCode(200).extract().as(DataFlowStatusMessage.class);
9291
assertThat(prepareResponse.state()).isEqualTo(PREPARED.name());
9392
assertThat(prepareResponse.dataAddress()).isNull();
9493

9594
var providerProcessId = "provider_" + processId;
96-
var startMessage = startMessage(providerProcessId, transferType);
95+
var startMessage = createStartMessage(providerProcessId, controlPlane.providerCallbackAddress(), transferType);
9796
var startResponse = controlPlane.providerStart(startMessage).statusCode(200).extract().as(DataFlowStatusMessage.class);
9897
assertThat(startResponse.state()).isEqualTo(STARTED.name());
9998
assertThat(startResponse.dataAddress()).isNotNull();
@@ -114,14 +113,14 @@ void shouldSuspendAndResumeOnProvider() {
114113
var transferType = "FileSystemStreaming-PULL";
115114
var processId = UUID.randomUUID().toString();
116115
var consumerProcessId = "consumer_" + processId;
117-
var prepareMessage = prepareMessage(consumerProcessId, transferType);
116+
var prepareMessage = createPrepareMessage(consumerProcessId, controlPlane.consumerCallbackAddress(), transferType);
118117

119118
var prepareResponse = controlPlane.consumerPrepare(prepareMessage).statusCode(200).extract().as(DataFlowStatusMessage.class);
120119
assertThat(prepareResponse.state()).isEqualTo(PREPARED.name());
121120
assertThat(prepareResponse.dataAddress()).isNull();
122121

123122
var providerProcessId = "provider_" + processId;
124-
var startMessage = startMessage(providerProcessId, transferType);
123+
var startMessage = createStartMessage(providerProcessId, controlPlane.providerCallbackAddress(), transferType);
125124
var startResponse = controlPlane.providerStart(startMessage).statusCode(200).extract().as(DataFlowStatusMessage.class);
126125
assertThat(startResponse.state()).isEqualTo(STARTED.name());
127126
assertThat(startResponse.dataAddress()).isNotNull();
@@ -141,18 +140,6 @@ void shouldSuspendAndResumeOnProvider() {
141140
consumerDataPlane.assertDataIsFlowing();
142141
}
143142

144-
private DataFlowPrepareMessage prepareMessage(String consumerProcessId, String transferType) {
145-
return new DataFlowPrepareMessage("theMessageId", "theParticipantId", "theCounterPartyId",
146-
"theDataspaceContext", consumerProcessId, "theAgreementId", "theDatasetId", controlPlane.consumerCallbackAddress(),
147-
transferType, emptyList(), emptyMap());
148-
}
149-
150-
private DataFlowStartMessage startMessage(String providerProcessId, String transferType) {
151-
return new DataFlowStartMessage("theMessageId", "theParticipantId", "theCounterPartyId",
152-
"theDataspaceContext", providerProcessId, "theAgreementId", "theDatasetId", controlPlane.providerCallbackAddress(),
153-
transferType, null, emptyList(), emptyMap());
154-
}
155-
156143
private DataFlowResumeMessage resumeMessage(String providerProcessId) {
157144
return new DataFlowResumeMessage("theMessageId", providerProcessId, null);
158145
}

0 commit comments

Comments
 (0)