Skip to content

Commit

Permalink
refactor: cleanup 0.6.x, 0.7.x and 0.8.x deprecations (#4726)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt authored Jan 22, 2025
1 parent 53c51be commit cf5d77e
Show file tree
Hide file tree
Showing 43 changed files with 97 additions and 688 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

package org.eclipse.edc.connector.core;

import org.eclipse.edc.junit.extensions.EdcExtension;
import org.eclipse.edc.junit.extensions.RuntimeExtension;
import org.eclipse.edc.junit.extensions.RuntimePerMethodExtension;
import org.eclipse.edc.spi.system.Hostname;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -25,11 +26,11 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.edc.connector.core.CoreServicesExtension.EDC_HOSTNAME;

@ExtendWith(EdcExtension.class)
@ExtendWith(RuntimePerMethodExtension.class)
class CoreServicesExtensionIntegrationTest {

@BeforeEach
void setUp(EdcExtension extension) {
void setUp(RuntimeExtension extension) {
extension.setConfiguration(Map.of(EDC_HOSTNAME, "hostname"));
}

Expand All @@ -38,4 +39,4 @@ void shouldProvideHostnameExtension(Hostname hostname) {
assertThat(hostname.get()).isEqualTo("hostname");
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* extension attaches a dependency injection container to the test lifecycle. Parameter injection of runtime services is
* supported.
* <p>
* If additional lifecycle services are needed (detection, loading and booting of extensions), use {@link EdcExtension}
* If additional lifecycle services are needed (detection, loading and booting of extensions), use {@link RuntimeExtension}
* instead.
* The {@link ServiceExtensionContext} instance is wrapped by a Mockito Spy.
*/
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ public class ExpirationIssuedAtValidationRule implements TokenValidationRule {
private final int issuedAtLeeway;
private final boolean allowNull;

/**
* Instantiates the rule
*
* @deprecated Please use {@link ExpirationIssuedAtValidationRule#ExpirationIssuedAtValidationRule(Clock, int, boolean)} instead
*/
@Deprecated(since = "0.7.0")
public ExpirationIssuedAtValidationRule(Clock clock, int issuedAtLeeway) {
this(clock, issuedAtLeeway, false);
}

public ExpirationIssuedAtValidationRule(Clock clock, int issuedAtLeeway, boolean allowNull) {
this.clock = clock;
this.issuedAtLeeway = issuedAtLeeway;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@ public class NotBeforeValidationRule implements TokenValidationRule {
private final int notBeforeLeeway;
private final boolean allowNull;

/**
* Instantiates the rule
*
* @deprecated Please use {@link NotBeforeValidationRule#NotBeforeValidationRule(Clock, int, boolean)} instead.
*/
@Deprecated(since = "0.7.0")
public NotBeforeValidationRule(Clock clock, int notBeforeLeeway) {
this(clock, notBeforeLeeway, false);
}

public NotBeforeValidationRule(Clock clock, int notBeforeLeeway, boolean allowNull) {
this.clock = clock;
this.notBeforeLeeway = notBeforeLeeway;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ExpirationIssuedAtValidationRuleTest {

private final Instant now = Instant.now().truncatedTo(ChronoUnit.SECONDS);
private final Clock clock = Clock.fixed(now, UTC);
private final TokenValidationRule rule = new ExpirationIssuedAtValidationRule(clock, 0);
private final TokenValidationRule rule = new ExpirationIssuedAtValidationRule(clock, 0, false);

@Test
void validationOk() {
Expand Down Expand Up @@ -110,7 +110,7 @@ void validationKoBecauseIssuedAtInFuture() {

@Test
void validationKoBecauseIssuedAtInFutureOutsideLeeway() {
var rule = new ExpirationIssuedAtValidationRule(clock, 5);
var rule = new ExpirationIssuedAtValidationRule(clock, 5, false);

var token = ClaimToken.Builder.newInstance()
.claim(EXPIRATION_TIME, Date.from(now.plusSeconds(60)))
Expand All @@ -125,7 +125,7 @@ void validationKoBecauseIssuedAtInFutureOutsideLeeway() {

@Test
void validationOkBecauseIssuedAtInFutureButWithinLeeway() {
var rule = new ExpirationIssuedAtValidationRule(clock, 20);
var rule = new ExpirationIssuedAtValidationRule(clock, 20, false);

var token = ClaimToken.Builder.newInstance()
.claim(EXPIRATION_TIME, Date.from(now.plusSeconds(60)))
Expand All @@ -152,7 +152,7 @@ void validationKoWithRoundedIssuedAtAndNoLeeway() {
var now = issuedAt.minus(250, ChronoUnit.MILLIS);

var clock = Clock.fixed(now, UTC);
var rule = new ExpirationIssuedAtValidationRule(clock, 0);
var rule = new ExpirationIssuedAtValidationRule(clock, 0, false);

var token = ClaimToken.Builder.newInstance()
.claim(EXPIRATION_TIME, Date.from(expiresAt))
Expand Down Expand Up @@ -180,7 +180,7 @@ void validationOkWithRoundedIssuedAtAndMinimalLeeway() {
var now = issuedAt.minus(250, ChronoUnit.MILLIS);

var clock = Clock.fixed(now, UTC);
var rule = new ExpirationIssuedAtValidationRule(clock, 2);
var rule = new ExpirationIssuedAtValidationRule(clock, 2, false);

var token = ClaimToken.Builder.newInstance()
.claim(EXPIRATION_TIME, Date.from(expiresAt))
Expand All @@ -191,4 +191,4 @@ void validationOkWithRoundedIssuedAtAndMinimalLeeway() {

assertThat(result.succeeded()).isTrue();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class NotBeforeValidationRuleTest {
private final int notBeforeLeeway = 20;
private final Instant now = Instant.now().truncatedTo(ChronoUnit.SECONDS);
private final Clock clock = Clock.fixed(now, UTC);
private final TokenValidationRule rule = new NotBeforeValidationRule(clock, notBeforeLeeway);
private final TokenValidationRule rule = new NotBeforeValidationRule(clock, notBeforeLeeway, false);

@Test
void validNotBefore() {
Expand Down Expand Up @@ -82,4 +82,4 @@ void validationKoBecauseNotBeforeTimeNotProvided_allowsNull() {
assertThat(result.succeeded()).isTrue();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import org.eclipse.edc.connector.dataplane.selector.spi.client.DataPlaneClientFactory;
import org.eclipse.edc.connector.dataplane.selector.spi.store.DataPlaneInstanceStore;
import org.eclipse.edc.junit.annotations.ComponentTest;
import org.eclipse.edc.junit.extensions.EdcExtension;
import org.eclipse.edc.junit.extensions.RuntimeExtension;
import org.eclipse.edc.junit.extensions.RuntimePerMethodExtension;
import org.eclipse.edc.spi.event.EventRouter;
import org.eclipse.edc.spi.event.EventSubscriber;
import org.eclipse.edc.spi.iam.IdentityService;
Expand All @@ -44,13 +45,13 @@
import static org.mockito.Mockito.verify;

@ComponentTest
@ExtendWith(EdcExtension.class)
@ExtendWith(RuntimePerMethodExtension.class)
public class AssetEventDispatchTest {

private final EventSubscriber eventSubscriber = mock();

@BeforeEach
void setUp(EdcExtension extension) {
void setUp(RuntimeExtension extension) {
extension.registerServiceMock(ProtocolWebhook.class, mock());
extension.registerServiceMock(DataPlaneInstanceStore.class, mock());
extension.registerServiceMock(IdentityService.class, mock());
Expand Down
Loading

0 comments on commit cf5d77e

Please sign in to comment.