-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: permit abandoned data transfers to be re-started by another dat…
…a-plane runtime (#4650) feat: permit interrupted data transfers to be started by another replica
- Loading branch information
Showing
33 changed files
with
636 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
core/common/junit/src/main/java/org/eclipse/edc/junit/matchers/ArrayContainsMatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (c) 2024 Cofinity-X | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Cofinity-X - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.junit.matchers; | ||
|
||
import org.mockito.internal.matchers.Equals; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
|
||
import static org.mockito.ArgumentMatchers.argThat; | ||
|
||
/** | ||
* Matches if the items contained in the "wanted" array are contained in the actual one. | ||
* Heavily inspired on {@link org.mockito.internal.matchers.ArrayEquals} | ||
*/ | ||
public class ArrayContainsMatcher extends Equals { | ||
|
||
@SuppressWarnings("unchecked") | ||
public static <T> T[] arrayContains(T[] items) { | ||
return (T[]) argThat(new ArrayContainsMatcher(items)); | ||
} | ||
|
||
public ArrayContainsMatcher(Object[] wanted) { | ||
super(wanted); | ||
} | ||
|
||
@Override | ||
public boolean matches(Object actual) { | ||
var wanted = getWanted(); | ||
if (wanted instanceof Object[] wantedArray && actual instanceof Object[] actualArray) { | ||
return new HashSet<>(Arrays.asList(actualArray)).containsAll(Arrays.asList(wantedArray)); | ||
} | ||
|
||
return super.matches(actual); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.