-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: restart interrupted data flows (#4612)
* feat: restart interrupted data flows * PR remarks * restart only push transfers * pr remark
- Loading branch information
Showing
20 changed files
with
364 additions
and
43 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
34 changes: 34 additions & 0 deletions
34
core/common/lib/query-lib/src/main/java/org/eclipse/edc/query/LessThanOperatorPredicate.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,34 @@ | ||
/* | ||
* 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.query; | ||
|
||
import org.eclipse.edc.spi.query.OperatorPredicate; | ||
|
||
import java.util.Comparator; | ||
|
||
public class LessThanOperatorPredicate implements OperatorPredicate { | ||
@Override | ||
public boolean test(Object value, Object comparedTo) { | ||
if (value instanceof Number number1 && comparedTo instanceof Number number2) { | ||
return Double.compare(number1.doubleValue(), number2.doubleValue()) < 0; | ||
} | ||
|
||
if (value instanceof String string1 && comparedTo instanceof String string2) { | ||
return Comparator.<String>naturalOrder().compare(string1, string2) < 0; | ||
} | ||
|
||
return false; | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
...mmon/lib/query-lib/src/test/java/org/eclipse/edc/query/LessThanOperatorPredicateTest.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,73 @@ | ||
/* | ||
* 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.query; | ||
|
||
import org.eclipse.edc.spi.query.OperatorPredicate; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.ArgumentsProvider; | ||
import org.junit.jupiter.params.provider.ArgumentsSource; | ||
|
||
import java.util.stream.Stream; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.params.provider.Arguments.arguments; | ||
|
||
class LessThanOperatorPredicateTest { | ||
|
||
private final OperatorPredicate predicate = new LessThanOperatorPredicate(); | ||
|
||
@ParameterizedTest | ||
@ArgumentsSource(ValidValues.class) | ||
void shouldReturnTrue_whenValueLessThanComparedOne(Object value, Object comparedTo) { | ||
assertThat(predicate.test(value, comparedTo)).isTrue(); | ||
} | ||
|
||
@ParameterizedTest | ||
@ArgumentsSource(InvalidValues.class) | ||
void shouldReturnFalse_whenValueNotLessThanComparedOne(Object value, Object comparedTo) { | ||
assertThat(predicate.test(value, comparedTo)).isFalse(); | ||
} | ||
|
||
private static class ValidValues implements ArgumentsProvider { | ||
|
||
@Override | ||
public Stream<? extends Arguments> provideArguments(ExtensionContext context) { | ||
return Stream.of( | ||
arguments(1, 2), | ||
arguments(1, 2L), | ||
arguments(1, 1.01f), | ||
arguments(1, 1.01d), | ||
arguments("a", "b") | ||
); | ||
} | ||
} | ||
|
||
private static class InvalidValues implements ArgumentsProvider { | ||
|
||
@Override | ||
public Stream<? extends Arguments> provideArguments(ExtensionContext context) { | ||
return Stream.of( | ||
arguments(1, 1), | ||
arguments(1, 1L), | ||
arguments(1, 1.0f), | ||
arguments(1, 1.0d), | ||
arguments("a", "a") | ||
); | ||
} | ||
} | ||
|
||
} |
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
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.