Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,7 @@ public void hGetExReturnsValueAndSetsExpiration() {
assertThat(result.get(0)).isEqualTo(VALUE_1_BYTES);
assertThat(clusterConnection.hashCommands().hExists(KEY_1_BYTES, KEY_2_BYTES)).isTrue();
assertThat(clusterConnection.hashCommands().hExists(KEY_1_BYTES, KEY_3_BYTES)).isTrue();
assertThat(clusterConnection.hashCommands().hTtl(KEY_1_BYTES, KEY_2_BYTES).get(0)).isPositive();
}

@Test // GH-3211
Expand All @@ -1348,6 +1349,7 @@ public void hGetExReturnsNullWhenFieldDoesNotExist() {
assertThat(result).hasSize(1);
assertThat(result.get(0)).isNull();
assertThat(clusterConnection.hashCommands().hExists(KEY_1_BYTES, KEY_2_BYTES)).isTrue();
assertThat(clusterConnection.hashCommands().hTtl(KEY_1_BYTES, KEY_2_BYTES).get(0)).isEqualTo(-1L);
}

@Test // GH-3211
Expand All @@ -1357,6 +1359,7 @@ public void hGetExReturnsNullWhenKeyDoesNotExist() {
List<byte[]> result = clusterConnection.hashCommands().hGetEx(KEY_1_BYTES, Expiration.seconds(60), KEY_2_BYTES);
assertThat(result).hasSize(1);
assertThat(result.get(0)).isNull();
assertThat(clusterConnection.hashCommands().hTtl(KEY_1_BYTES, KEY_2_BYTES).get(0)).isEqualTo(-2L);
}

@Test // GH-3211
Expand All @@ -1375,6 +1378,7 @@ public void hGetExMultipleFieldsReturnsValuesAndSetsExpiration() {
assertThat(clusterConnection.hashCommands().hExists(KEY_1_BYTES, KEY_2_BYTES)).isTrue();
assertThat(clusterConnection.hashCommands().hExists(KEY_1_BYTES, KEY_3_BYTES)).isTrue();
assertThat(clusterConnection.hashCommands().hExists(KEY_1_BYTES, "field3".getBytes())).isTrue();
assertThat(clusterConnection.hashCommands().hTtl(KEY_1_BYTES, KEY_2_BYTES).get(0)).isPositive();
}

@Test // GH-3211
Expand All @@ -1389,6 +1393,7 @@ public void hGetExMultipleFieldsWithNonExistentFields() {
assertThat(result.get(0)).isEqualTo(VALUE_1_BYTES);
assertThat(result.get(1)).isNull();
assertThat(clusterConnection.hashCommands().hExists(KEY_1_BYTES, KEY_2_BYTES)).isTrue();
assertThat(clusterConnection.hashCommands().hTtl(KEY_1_BYTES, KEY_2_BYTES).get(0)).isPositive();
}

@Test // GH-3211
Expand All @@ -1403,6 +1408,7 @@ public void hSetExUpsertConditionSetsFieldsWithExpiration() {
assertThat(clusterConnection.hashCommands().hExists(KEY_1_BYTES, KEY_3_BYTES)).isTrue();
assertThat(clusterConnection.hashCommands().hGet(KEY_1_BYTES, KEY_2_BYTES)).isEqualTo(VALUE_1_BYTES);
assertThat(clusterConnection.hashCommands().hGet(KEY_1_BYTES, KEY_3_BYTES)).isEqualTo(VALUE_2_BYTES);
assertThat(clusterConnection.hashCommands().hTtl(KEY_1_BYTES, KEY_2_BYTES).get(0)).isPositive();
}

@Test // GH-3211
Expand All @@ -1417,6 +1423,7 @@ public void hSetExIfNoneExistConditionSucceedsWhenNoFieldsExist() {
assertThat(clusterConnection.hashCommands().hExists(KEY_1_BYTES, KEY_3_BYTES)).isTrue();
assertThat(clusterConnection.hashCommands().hGet(KEY_1_BYTES, KEY_2_BYTES)).isEqualTo(VALUE_1_BYTES);
assertThat(clusterConnection.hashCommands().hGet(KEY_1_BYTES, KEY_3_BYTES)).isEqualTo(VALUE_2_BYTES);
assertThat(clusterConnection.hashCommands().hTtl(KEY_1_BYTES, KEY_2_BYTES).get(0)).isPositive();
}

@Test // GH-3211
Expand All @@ -1431,6 +1438,7 @@ public void hSetExIfNoneExistConditionFailsWhenSomeFieldsExist() {
assertThat(result).isFalse();
assertThat(clusterConnection.hashCommands().hGet(KEY_1_BYTES, KEY_2_BYTES)).isEqualTo(VALUE_1_BYTES); // unchanged
assertThat(clusterConnection.hashCommands().hExists(KEY_1_BYTES, KEY_3_BYTES)).isFalse(); // not set
assertThat(clusterConnection.hashCommands().hTtl(KEY_1_BYTES, KEY_2_BYTES).get(0)).isEqualTo(-1L);
}

@Test // GH-3211
Expand All @@ -1446,6 +1454,7 @@ public void hSetExIfAllExistConditionSucceedsWhenAllFieldsExist() {
assertThat(result).isTrue();
assertThat(clusterConnection.hashCommands().hGet(KEY_1_BYTES, KEY_2_BYTES)).isEqualTo("new-value-1".getBytes()); // updated
assertThat(clusterConnection.hashCommands().hGet(KEY_1_BYTES, KEY_3_BYTES)).isEqualTo("new-value-2".getBytes()); // updated
assertThat(clusterConnection.hashCommands().hTtl(KEY_1_BYTES, KEY_2_BYTES).get(0)).isPositive();
}

@Test // GH-3211
Expand All @@ -1460,6 +1469,7 @@ public void hSetExIfAllExistConditionFailsWhenSomeFieldsMissing() {
assertThat(result).isFalse();
assertThat(clusterConnection.hashCommands().hGet(KEY_1_BYTES, KEY_2_BYTES)).isEqualTo(VALUE_1_BYTES); // unchanged
assertThat(clusterConnection.hashCommands().hExists(KEY_1_BYTES, KEY_3_BYTES)).isFalse(); // not set
assertThat(clusterConnection.hashCommands().hTtl(KEY_1_BYTES, KEY_2_BYTES).get(0)).isEqualTo(-1L);
}

@Test // DATAREDIS-315
Expand Down