-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Aerospike ClintPolicy maxSocketIdle property override
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 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
41 changes: 41 additions & 0 deletions
41
...-backend/src/test/java/com/playtika/janusgraph/aerospike/AerospikePolicyProviderTest.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,41 @@ | ||
package com.playtika.janusgraph.aerospike; | ||
|
||
import com.aerospike.client.policy.ClientPolicy; | ||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.testcontainers.containers.GenericContainer; | ||
|
||
import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeConfiguration; | ||
import static com.playtika.janusgraph.aerospike.AerospikeTestUtils.getAerospikeContainer; | ||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; | ||
|
||
public class AerospikePolicyProviderTest { | ||
|
||
@ClassRule | ||
public static GenericContainer<?> container = getAerospikeContainer(); | ||
|
||
@Test | ||
public void shouldReturnDefaultClientPolicyMaxSocketIdle() { | ||
var aerospikePolicyProvider = new AerospikePolicyProvider( | ||
getAerospikeConfiguration(container) | ||
); | ||
|
||
var clientPolicy = aerospikePolicyProvider.clientPolicy(); | ||
|
||
assertThat(clientPolicy.maxSocketIdle) | ||
.isEqualTo(new ClientPolicy().maxSocketIdle); | ||
} | ||
|
||
@Test | ||
public void shouldOverrideClientPolicyMaxSocketIdle() { | ||
var clientMaxSocketIdle = 55; | ||
var aerospikePolicyProvider = new AerospikePolicyProvider( | ||
getAerospikeConfiguration(container) | ||
.set(ConfigOptions.AEROSPIKE_CLIENT_MAX_SOCKET_IDLE, clientMaxSocketIdle) | ||
); | ||
|
||
var clientPolicy = aerospikePolicyProvider.clientPolicy(); | ||
|
||
assertThat(clientPolicy.maxSocketIdle).isEqualTo(clientMaxSocketIdle); | ||
} | ||
} |