Skip to content

Commit f04cf0b

Browse files
committed
adapt tests
1 parent 202f37e commit f04cf0b

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

cloudplatform/connectivity-destination-service/src/test/java/com/sap/cloud/sdk/cloudplatform/connectivity/DestinationServiceTest.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,9 +1255,13 @@ void testConcurrentFetchSameDestinationButDifferentTenant()
12551255
assertThat(DestinationService.Cache.isolationLocks().asMap())
12561256
.containsOnlyKeys(
12571257
CacheKey.fromIds("TenantA", null).append(destinationName, options),
1258-
CacheKey.fromIds("TenantA", null).append(options),
1258+
CacheKey
1259+
.fromIds("TenantA", null)
1260+
.append(DestinationServiceOptionsAugmenter.getRetrievalStrategy(options)),
12591261
CacheKey.fromIds("TenantB", null).append(destinationName, options),
1260-
CacheKey.fromIds("TenantB", null).append(options));
1262+
CacheKey
1263+
.fromIds("TenantB", null)
1264+
.append(DestinationServiceOptionsAugmenter.getRetrievalStrategy(options)));
12611265

12621266
// assert cache entries for one get-single command for each tenant
12631267
assertThat(DestinationService.Cache.instanceSingle().asMap())
@@ -1327,7 +1331,9 @@ void testPrincipalIsolationForDestinationWithUserPropagationWithExchangeOnlyStra
13271331
.containsOnlyKeys(
13281332
CacheKey.of(subscriberTenant, principal1).append(destinationName, options),
13291333
CacheKey.of(subscriberTenant, principal2).append(destinationName, options),
1330-
CacheKey.of(subscriberTenant, null).append(options));
1334+
CacheKey
1335+
.of(subscriberTenant, null)
1336+
.append(DestinationServiceOptionsAugmenter.getRetrievalStrategy(options)));
13311337

13321338
assertThat(DestinationService.Cache.instanceSingle().asMap())
13331339
.containsOnlyKeys(
@@ -1371,7 +1377,9 @@ void testPrincipalIsolationForDestinationWithUserPropagationWithDefaultExchangeS
13711377
assertThat(DestinationService.Cache.isolationLocks().asMap())
13721378
.containsOnlyKeys(
13731379
CacheKey.of(subscriberTenant, null).append(destinationName, options),
1374-
CacheKey.of(subscriberTenant, null).append(options));
1380+
CacheKey
1381+
.of(subscriberTenant, null)
1382+
.append(DestinationServiceOptionsAugmenter.getRetrievalStrategy(options)));
13751383

13761384
assertThat(DestinationService.Cache.instanceSingle().asMap())
13771385
.containsOnlyKeys(

cloudplatform/connectivity-destination-service/src/test/java/com/sap/cloud/sdk/cloudplatform/connectivity/GetOrComputeAllDestinationsCommandTest.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ void testCommandIsIdempotent()
9090
assertThat(result.get()).containsExactly(destination);
9191

9292
assertThat(allDestinationsCache.estimatedSize()).isEqualTo(1);
93-
assertThat(allDestinationsCache.getIfPresent(CacheKey.ofNoIsolation().append(EMPTY_OPTIONS)))
93+
assertThat(
94+
allDestinationsCache
95+
.getIfPresent(
96+
CacheKey
97+
.ofNoIsolation()
98+
.append(DestinationServiceOptionsAugmenter.getRetrievalStrategy(EMPTY_OPTIONS))))
9499
.containsExactly(destination);
95100
verify(tryGetAllDestinations, times(1)).get();
96101
}
@@ -104,8 +109,10 @@ void testIsolationAndAtomicityPerTenant()
104109
final CountDownLatch mainThreadLatch = new CountDownLatch(1);
105110
final CountDownLatch getAllLatch = new CountDownLatch(1);
106111
final AtomicInteger lockInvocations = new AtomicInteger();
107-
final CacheKey t1Key = CacheKey.of(t1, null).append(EMPTY_OPTIONS);
108-
final CacheKey t2Key = CacheKey.of(t2, null).append(EMPTY_OPTIONS);
112+
final CacheKey t1Key =
113+
CacheKey.of(t1, null).append(DestinationServiceOptionsAugmenter.getRetrievalStrategy(EMPTY_OPTIONS));
114+
final CacheKey t2Key =
115+
CacheKey.of(t2, null).append(DestinationServiceOptionsAugmenter.getRetrievalStrategy(EMPTY_OPTIONS));
109116
final ReentrantLock tenantIsolationLock = spy(ReentrantLock.class);
110117

111118
doAnswer(invocation -> {

0 commit comments

Comments
 (0)