-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9be1383
commit acc9ab7
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/test/java/com/vinted/kafka/connect/vespa/VespaSinkConfigTest.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 @@ | ||
package com.vinted.kafka.connect.vespa; | ||
|
||
import ai.vespa.feed.client.FeedClient; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertIterableEquals; | ||
|
||
public class VespaSinkConfigTest { | ||
private final Map<String, String> params = new HashMap<>(); | ||
|
||
@Test | ||
void createsDefaultRetryStrategy() { | ||
VespaSinkConfig config = new VespaSinkConfig(params); | ||
|
||
assertEquals(10, config.retryStrategyRetries); | ||
assertIterableEquals(Arrays.asList(FeedClient.OperationType.PUT, FeedClient.OperationType.UPDATE, FeedClient.OperationType.REMOVE), config.retryStrategyOperationsTypes); | ||
} | ||
|
||
@Test | ||
void overridesRetryStrategy() { | ||
params.put("vespa.retry.strategy.retries", "20"); | ||
params.put("vespa.retry.strategy.operation.types", "UPDATE,REMOVE"); | ||
|
||
VespaSinkConfig config = new VespaSinkConfig(params); | ||
|
||
assertEquals(20, config.retryStrategyRetries); | ||
assertIterableEquals(Arrays.asList(FeedClient.OperationType.UPDATE, FeedClient.OperationType.REMOVE), config.retryStrategyOperationsTypes); | ||
} | ||
} |