Skip to content

Commit

Permalink
chore: Deprecate RfcDestination and associated usages (#330)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Dümont <[email protected]>
  • Loading branch information
CharlesDuboisSAP and newtork authored Feb 28, 2024
1 parent acbcddf commit b06aae0
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@

/**
* Immutable default implementation of the {@link RfcDestination} interface.
*
* @deprecated Please use {@link DefaultDestination} instead.
*/
@Deprecated
@EqualsAndHashCode
@RequiredArgsConstructor( access = AccessLevel.PRIVATE )
public final class DefaultRfcDestination implements RfcDestination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ default boolean isHttp()
*
* @throws IllegalArgumentException
* if this object cannot be converted as a {@code RfcDestination}.
*
* @deprecated Please use the {@link Destination} as is by removing the {@code asRfc()} conversion.
*/
@Deprecated
@Nonnull
default RfcDestination asRfc()
throws IllegalArgumentException
Expand All @@ -63,6 +66,7 @@ default RfcDestination asRfc()
*
* @return {@code true}, if a call to {@link #asRfc()} will succeed; {@code false} otherwise.
*/
@Deprecated
default boolean isRfc()
{
return this instanceof RfcDestination || DefaultRfcDestination.canBeConstructedFrom(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ private Destination extractDestination( final String destinationName )
+ ".");
}

@SuppressWarnings( "deprecation" )
private Destination parseDestination( final JsonNode destinationNode )
{
final HashMap<String, String> map = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
* Platform independent representation of a rfc destination as a collection of key-value pairs.
* <p>
* Additionally, provides an easy way to decorate itself with a given decorator function.
*
* @deprecated Please use {@link Destination} instead.
*/
@Deprecated
public interface RfcDestination extends Destination, RfcDestinationProperties
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

/**
* Adds RFC relevant fields to the "generic" destination.
*
* @deprecated Please use {@link DefaultDestination} instead.
*/
@Deprecated
public interface RfcDestinationProperties extends DestinationProperties
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class CustomDestinationRegistrationTest
private static final HttpDestination httpDestination =
DefaultHttpDestination.builder("foo").name("httpDestination").build();

@SuppressWarnings( "deprecation" )
private static final RfcDestination rfcDestination =
DefaultDestination.builder().name("rfcDestination").build().asRfc();

Expand All @@ -27,6 +28,7 @@ void resetDestinationAccessor()
DestinationAccessor.setLoader(null);
}

@SuppressWarnings( "deprecation" )
@Test
void testBasicUseCase()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.net.URI;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.jupiter.api.Test;

Expand All @@ -25,6 +26,7 @@ void testSimpleConstruction()
assertThat(destination.get(someKey)).contains(someValue);
}

@SuppressWarnings( "deprecation" )
@Test
void testIdentity()
{
Expand Down Expand Up @@ -55,8 +57,8 @@ void testGetPropertyNames()
final String someKey = "someKey";
final String someValue = "someValue";
final DestinationProperties destination = DefaultDestination.builder().property(someKey, someValue).build();
Iterable<String> propertiesKeysResult = destination.getPropertyNames();
Iterable<String> expectedKeys = Arrays.asList(someKey);
final Iterable<String> propertiesKeysResult = destination.getPropertyNames();
final Iterable<String> expectedKeys = List.of(someKey);
assertThat(propertiesKeysResult).containsAll(expectedKeys);
}

Expand All @@ -82,7 +84,7 @@ void testModifiedMapDoesntInfluenceDestination()
final String someKey = "someKey";
final String originalValue = "someValue";

final HashMap<String, Object> properties = new HashMap<>();
final Map<String, Object> properties = new HashMap<>();
properties.put(someKey, originalValue);

final DestinationProperties destination = DefaultDestination.fromMap(properties).build();
Expand Down Expand Up @@ -125,6 +127,7 @@ void testHttpConverter()
assertThat(httpDestination).isInstanceOf(DefaultHttpDestination.class);
}

@Deprecated
@Test
void testRfcConverter()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.assertj.vavr.api.VavrAssertions;
import org.junit.jupiter.api.Test;

@Deprecated
class DefaultRfcDestinationTest
{
private static final String SOME_NAME = "Some Destination Name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ private static String getDestinationTenantId( @Nonnull final OnBehalfOf onBehalf
}
}

@Deprecated
private static Destination handleRfcDestination( final DestinationProperties baseProperties )
{
return DefaultRfcDestination.fromProperties(baseProperties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void testDefaultDestination()
assertThat(result.get("foo")).contains("bar");
}

@Deprecated
@Test
void testRfcDestination()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ void testTokenExchangeExchangeOnly()
verify(scpCfDestinationServiceAdapter, times(0)).getConfigurationAsJsonWithUserToken(any(), any());
}

@SuppressWarnings( "deprecation" )
@Test
void testEmailDestination()
{
Expand Down
2 changes: 1 addition & 1 deletion release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

### 🔧 Compatibility Notes

-
- Deprecated `RfcDestination` and all associated usages. The replacement is `Destination`.

### ✨ New Functionality

Expand Down

0 comments on commit b06aae0

Please sign in to comment.