4848import org .eclipse .edc .spi .types .domain .message .RemoteMessage ;
4949import org .eclipse .edc .transaction .spi .NoopTransactionContext ;
5050import org .eclipse .edc .transaction .spi .TransactionContext ;
51- import org .eclipse .edc .validator .spi .DataAddressValidatorRegistry ;
52- import org .eclipse .edc .validator .spi .ValidationResult ;
5351import org .junit .jupiter .api .BeforeEach ;
5452import org .junit .jupiter .api .Nested ;
5553import org .junit .jupiter .api .Test ;
8684import static org .eclipse .edc .spi .result .ServiceFailure .Reason .BAD_REQUEST ;
8785import static org .eclipse .edc .spi .result .ServiceFailure .Reason .CONFLICT ;
8886import static org .eclipse .edc .spi .result .ServiceFailure .Reason .NOT_FOUND ;
89- import static org .eclipse .edc .validator .spi .Violation .violation ;
9087import static org .junit .jupiter .params .provider .Arguments .arguments ;
9188import static org .mockito .ArgumentMatchers .any ;
9289import static org .mockito .ArgumentMatchers .anyString ;
@@ -107,7 +104,6 @@ class TransferProcessProtocolServiceImplTest {
107104 private final TransactionContext transactionContext = spy (new NoopTransactionContext ());
108105 private final ContractNegotiationStore negotiationStore = mock ();
109106 private final ContractValidationService validationService = mock ();
110- private final DataAddressValidatorRegistry dataAddressValidator = mock ();
111107 private final TransferProcessListener listener = mock ();
112108 private final ProtocolTokenValidator protocolTokenValidator = mock ();
113109 private final DataAddressStore dataAddressStore = mock ();
@@ -124,7 +120,7 @@ void setUp() {
124120 var observable = new TransferProcessObservableImpl ();
125121 observable .registerListener (listener );
126122 service = new TransferProcessProtocolServiceImpl (store , transactionContext , negotiationStore , validationService ,
127- protocolTokenValidator , dataAddressValidator , observable , mock (), dataFlowController ,
123+ protocolTokenValidator , observable , mock (), dataFlowController ,
128124 dataAddressStore , transferProcessProviderFactory );
129125 when (store .save (any ())).thenReturn (StoreResult .success ());
130126 }
@@ -340,7 +336,6 @@ void validAgreement_shouldInitiateTransfer() {
340336 when (validationService .validateRequest (any (), isA (ContractAgreement .class ))).thenReturn (Result .success ());
341337 when (negotiationStore .queryAgreements (any ())).thenReturn (Stream .of (contractAgreement ()));
342338 when (validationService .validateAgreement (any (ParticipantAgent .class ), any ())).thenReturn (Result .success (null ));
343- when (dataAddressValidator .validateDestination (any ())).thenReturn (ValidationResult .success ());
344339 when (dataFlowController .transferTypesFor (anyString ())).thenReturn (Set .of ("transferType" ));
345340 when (dataAddressStore .store (any (), any ())).thenReturn (StoreResult .success ());
346341 var transferProcess = transferProcess (INITIAL , "transferProcessId" );
@@ -374,7 +369,6 @@ void shouldFail_whenInvalidRequest() {
374369 when (validationService .validateRequest (any (), isA (ContractAgreement .class ))).thenReturn (Result .failure ("invalid credentials" ));
375370 when (negotiationStore .queryAgreements (any ())).thenReturn (Stream .of (contractAgreement ()));
376371 when (validationService .validateAgreement (any (ParticipantAgent .class ), any ())).thenReturn (Result .success (null ));
377- when (dataAddressValidator .validateDestination (any ())).thenReturn (ValidationResult .success ());
378372 var transferProcess = transferProcess (INITIAL , "transferProcessId" );
379373 when (transferProcessProviderFactory .create (any (), any (), any (), any ())).thenReturn (ServiceResult .success (transferProcess ));
380374
@@ -404,7 +398,6 @@ void shouldFail_whenDataAddressStorageFails() {
404398 when (validationService .validateRequest (any (), isA (ContractAgreement .class ))).thenReturn (Result .success ());
405399 when (negotiationStore .queryAgreements (any ())).thenReturn (Stream .of (contractAgreement ()));
406400 when (validationService .validateAgreement (any (ParticipantAgent .class ), any ())).thenReturn (Result .success (null ));
407- when (dataAddressValidator .validateDestination (any ())).thenReturn (ValidationResult .success ());
408401 when (dataFlowController .transferTypesFor (anyString ())).thenReturn (Set .of ("transferType" ));
409402 when (dataAddressStore .store (any (), any ())).thenReturn (StoreResult .generalError ("error" ));
410403 when (transferProcessProviderFactory .create (any (), any (), any (), any ())).thenReturn (ServiceResult .success (transferProcess (INITIAL , "transferProcessId" )));
@@ -433,7 +426,6 @@ void shouldFail_whenTransferProcessCreationFails() {
433426 when (validationService .validateRequest (any (), isA (ContractAgreement .class ))).thenReturn (Result .success ());
434427 when (negotiationStore .queryAgreements (any ())).thenReturn (Stream .of (contractAgreement ()));
435428 when (validationService .validateAgreement (any (ParticipantAgent .class ), any ())).thenReturn (Result .success (null ));
436- when (dataAddressValidator .validateDestination (any ())).thenReturn (ValidationResult .success ());
437429 when (dataFlowController .transferTypesFor (anyString ())).thenReturn (Set .of ("transferType" ));
438430 when (transferProcessProviderFactory .create (any (), any (), any (), any ())).thenReturn (ServiceResult .badRequest ("cannot create transfer process" ));
439431
@@ -464,7 +456,6 @@ void doNothingIfProcessAlreadyExist() {
464456 when (validationService .validateRequest (any (), isA (ContractAgreement .class ))).thenReturn (Result .success ());
465457 when (negotiationStore .queryAgreements (any ())).thenReturn (Stream .of (contractAgreement ()));
466458 when (validationService .validateAgreement (any (ParticipantAgent .class ), any ())).thenReturn (Result .success (null ));
467- when (dataAddressValidator .validateDestination (any ())).thenReturn (ValidationResult .success ());
468459 when (store .findForCorrelationId (any ())).thenReturn (transferProcess (REQUESTED , "transferProcessId" ));
469460 when (dataFlowController .transferTypesFor (anyString ())).thenReturn (Set .of ("transferType" ));
470461
@@ -492,7 +483,6 @@ void invalidAgreement_shouldNotInitiateTransfer() {
492483 when (validationService .validateRequest (any (), isA (ContractAgreement .class ))).thenReturn (Result .success ());
493484 when (negotiationStore .queryAgreements (any ())).thenReturn (Stream .of (contractAgreement ()));
494485 when (validationService .validateAgreement (any (ParticipantAgent .class ), any ())).thenReturn (Result .failure ("error" ));
495- when (dataAddressValidator .validateDestination (any ())).thenReturn (ValidationResult .success ());
496486 when (dataFlowController .transferTypesFor (anyString ())).thenReturn (Set .of ("transferType" ));
497487
498488 var result = service .notifyRequested (participantContext , message , tokenRepresentation );
@@ -517,7 +507,6 @@ void invalidDestination_shouldNotInitiateTransfer() {
517507 when (negotiationStore .queryAgreements (any ())).thenReturn (Stream .of (contractAgreement ()));
518508 when (protocolTokenValidator .verify (eq (participantContext ), eq (tokenRepresentation ), any (), any (), eq (message ))).thenReturn (ServiceResult .success (participantAgent ));
519509 when (validationService .validateRequest (any (), isA (ContractAgreement .class ))).thenReturn (Result .success ());
520- when (dataAddressValidator .validateDestination (any ())).thenReturn (ValidationResult .failure (violation ("invalid data address" , "path" )));
521510
522511 var result = service .notifyRequested (participantContext , message , tokenRepresentation );
523512
@@ -544,7 +533,6 @@ void shouldReturnBadRequest_whenTransferTypeNotSupported() {
544533 when (validationService .validateRequest (any (), isA (ContractAgreement .class ))).thenReturn (Result .success ());
545534 when (negotiationStore .queryAgreements (any ())).thenReturn (Stream .of (contractAgreement ));
546535 when (validationService .validateAgreement (any (ParticipantAgent .class ), any ())).thenReturn (Result .success (contractAgreement ));
547- when (dataAddressValidator .validateDestination (any ())).thenReturn (ValidationResult .success ());
548536 when (dataFlowController .transferTypesFor (anyString ())).thenReturn (Set .of ("supported-transfer-type" ));
549537
550538 var result = service .notifyRequested (participantContext , message , tokenRepresentation );
0 commit comments